[clang] c0ce44e - [Tooling/Inclusion] Update std symbols mapping (#113612)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 05:55:41 PST 2024


Author: Vadim D.
Date: 2024-11-04T14:55:38+01:00
New Revision: c0ce44e8fc03882641f270539265b20dba0fffdd

URL: https://github.com/llvm/llvm-project/commit/c0ce44e8fc03882641f270539265b20dba0fffdd
DIFF: https://github.com/llvm/llvm-project/commit/c0ce44e8fc03882641f270539265b20dba0fffdd.diff

LOG: [Tooling/Inclusion] Update std symbols mapping (#113612)

Fixes #113494

Added: 
    

Modified: 
    clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
    clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
    clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
    clang/tools/include-mapping/cppreference_parser.py

Removed: 
    


################################################################################
diff  --git a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
index 0832bcf66145fa..90c95d5cf60d86 100644
--- a/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
+++ b/clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp
@@ -115,19 +115,19 @@ static int initialize(Lang Language) {
       NSLen = 0;
     }
 
-    if (SymIndex >= 0 &&
-        Mapping->SymbolNames[SymIndex].qualifiedName() == QName) {
-      // Not a new symbol, use the same index.
+    if (SymIndex > 0) {
       assert(llvm::none_of(llvm::ArrayRef(Mapping->SymbolNames, SymIndex),
                            [&QName](const SymbolHeaderMapping::SymbolName &S) {
                              return S.qualifiedName() == QName;
                            }) &&
              "The symbol has been added before, make sure entries in the .inc "
              "file are grouped by symbol name!");
-    } else {
+    }
+    if (SymIndex < 0 ||
+        Mapping->SymbolNames[SymIndex].qualifiedName() != QName) {
       // First symbol or new symbol, increment next available index.
       ++SymIndex;
-    }
+    } // Else use the same index.
     Mapping->SymbolNames[SymIndex] = {
         QName.data(), NSLen, static_cast<unsigned int>(QName.size() - NSLen)};
     if (!HeaderName.empty())

diff  --git a/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc b/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
index 4d466013eeac3f..8f20ce98152f08 100644
--- a/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
+++ b/clang/lib/Tooling/Inclusions/Stdlib/StdSpecialSymbolMap.inc
@@ -232,6 +232,38 @@ SYMBOL(ssize, std::, <string_view>)
 SYMBOL(ssize, std::, <unordered_map>)
 SYMBOL(ssize, std::, <unordered_set>)
 SYMBOL(ssize, std::, <vector>)
+// C++ [range.access.general]: ... the customization point objects
+// in [range.access] are available when the header <iterator> is included.
+// (see https://eel.is/c++draft/range.access#general)
+SYMBOL(begin, std::ranges::, <ranges>)
+SYMBOL(begin, std::ranges::, <iterator>)
+SYMBOL(end, std::ranges::, <ranges>)
+SYMBOL(end, std::ranges::, <iterator>)
+SYMBOL(cbegin, std::ranges::, <ranges>)
+SYMBOL(cbegin, std::ranges::, <iterator>)
+SYMBOL(cend, std::ranges::, <ranges>)
+SYMBOL(cend, std::ranges::, <iterator>)
+SYMBOL(rbegin, std::ranges::, <ranges>)
+SYMBOL(rbegin, std::ranges::, <iterator>)
+SYMBOL(rend, std::ranges::, <ranges>)
+SYMBOL(rend, std::ranges::, <iterator>)
+SYMBOL(crbegin, std::ranges::, <ranges>)
+SYMBOL(crbegin, std::ranges::, <iterator>)
+SYMBOL(crend, std::ranges::, <ranges>)
+SYMBOL(crend, std::ranges::, <iterator>)
+SYMBOL(size, std::ranges::, <ranges>)
+SYMBOL(size, std::ranges::, <iterator>)
+SYMBOL(ssize, std::ranges::, <ranges>)
+SYMBOL(ssize, std::ranges::, <iterator>)
+SYMBOL(empty, std::ranges::, <ranges>)
+SYMBOL(empty, std::ranges::, <iterator>)
+SYMBOL(data, std::ranges::, <ranges>)
+SYMBOL(data, std::ranges::, <iterator>)
+SYMBOL(cdata, std::ranges::, <ranges>)
+SYMBOL(cdata, std::ranges::, <iterator>)
+
+// Ignore specializations
+SYMBOL(hash, std::, <functional>)
 
 // Add headers for generic integer-type abs.
 // Ignore other variants (std::complex, std::valarray, std::intmax_t)
@@ -352,20 +384,23 @@ SYMBOL(get, std::, /*no headers*/)
 // providing the type.
 SYMBOL(make_error_code, std::, /*no headers*/)
 SYMBOL(make_error_condition, std::, /*no headers*/)
+// Similar to std::get, has variants for multiple containers
+// (vector, deque, list, etc.)
+SYMBOL(erase, std::, /*no headers*/)
+SYMBOL(erase_if, std::, /*no headers*/)
 
 // cppreference symbol index page was missing these symbols.
 // Remove them when the cppreference offline archive catches up.
-SYMBOL(index_sequence, std::, <utility>)
-SYMBOL(index_sequence_for, std::, <utility>)
-SYMBOL(make_index_sequence, std::, <utility>)
-SYMBOL(make_integer_sequence, std::, <utility>)
+SYMBOL(regular_invocable, std::, <concepts>)
 
 // Symbols missing from the generated symbol map as reported by users.
 // Remove when the generator starts producing them.
-SYMBOL(make_any, std::, <any>)
-SYMBOL(any_cast, std::, <any>)
 SYMBOL(div, std::, <cstdlib>)
 SYMBOL(abort, std::, <cstdlib>)
+SYMBOL(atomic_wait, std::, <atomic>)
+SYMBOL(atomic_wait_explicit, std::, <atomic>)
+SYMBOL(move_backward, std::, <algorithm>)
+SYMBOL(month_weekday, std::chrono::, <chrono>)
 
 SYMBOL(binary_search, std::ranges::, <algorithm>)
 SYMBOL(equal_range, std::ranges::, <algorithm>)

diff  --git a/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc b/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
index b46bd2e4d7a4b5..b4afd0228694ff 100644
--- a/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
+++ b/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc
@@ -6,7 +6,7 @@
 // This file was generated automatically by
 // clang/tools/include-mapping/gen_std.py, DO NOT EDIT!
 //
-// Generated from cppreference offline HTML book (modified on 2022-07-30).
+// Generated from cppreference offline HTML book (modified on 2024-06-10).
 //===----------------------------------------------------------------------===//
 
 SYMBOL(ATOMIC_BOOL_LOCK_FREE, None, <atomic>)
@@ -598,7 +598,6 @@ SYMBOL(aligned_union_t, std::, <type_traits>)
 SYMBOL(alignment_of, std::, <type_traits>)
 SYMBOL(alignment_of_v, std::, <type_traits>)
 SYMBOL(all_of, std::, <algorithm>)
-SYMBOL(allocate_at_least, std::, <memory>)
 SYMBOL(allocate_shared, std::, <memory>)
 SYMBOL(allocate_shared_for_overwrite, std::, <memory>)
 SYMBOL(allocation_result, std::, <memory>)
@@ -607,6 +606,7 @@ SYMBOL(allocator_arg, std::, <memory>)
 SYMBOL(allocator_arg_t, std::, <memory>)
 SYMBOL(allocator_traits, std::, <memory>)
 SYMBOL(any, std::, <any>)
+SYMBOL(any_cast, std::, <any>)
 SYMBOL(any_of, std::, <algorithm>)
 SYMBOL(apply, std::, <tuple>)
 SYMBOL(arg, std::, <complex>)
@@ -727,8 +727,6 @@ SYMBOL(atomic_signal_fence, std::, <atomic>)
 SYMBOL(atomic_store, std::, <atomic>)
 SYMBOL(atomic_store_explicit, std::, <atomic>)
 SYMBOL(atomic_thread_fence, std::, <atomic>)
-SYMBOL(atomic_wait, std::, <atomic>)
-SYMBOL(atomic_wait_explicit, std::, <atomic>)
 SYMBOL(atto, std::, <ratio>)
 SYMBOL(auto_ptr, std::, <memory>)
 SYMBOL(back_insert_iterator, std::, <iterator>)
@@ -738,6 +736,7 @@ SYMBOL(bad_any_cast, std::, <any>)
 SYMBOL(bad_array_new_length, std::, <new>)
 SYMBOL(bad_cast, std::, <typeinfo>)
 SYMBOL(bad_exception, std::, <exception>)
+SYMBOL(bad_expected_access, std::, <expected>)
 SYMBOL(bad_function_call, std::, <functional>)
 SYMBOL(bad_optional_access, std::, <optional>)
 SYMBOL(bad_typeid, std::, <typeinfo>)
@@ -745,12 +744,14 @@ SYMBOL(bad_variant_access, std::, <variant>)
 SYMBOL(bad_weak_ptr, std::, <memory>)
 SYMBOL(barrier, std::, <barrier>)
 SYMBOL(basic_common_reference, std::, <type_traits>)
+SYMBOL(basic_const_iterator, std::, <iterator>)
 SYMBOL(basic_filebuf, std::, <fstream>)
 SYMBOL(basic_filebuf, std::, <iosfwd>)
 SYMBOL(basic_format_arg, std::, <format>)
 SYMBOL(basic_format_args, std::, <format>)
 SYMBOL(basic_format_context, std::, <format>)
 SYMBOL(basic_format_parse_context, std::, <format>)
+SYMBOL(basic_format_string, std::, <format>)
 SYMBOL(basic_fstream, std::, <fstream>)
 SYMBOL(basic_fstream, std::, <iosfwd>)
 SYMBOL(basic_ifstream, std::, <fstream>)
@@ -932,11 +933,13 @@ SYMBOL(conditional_t, std::, <type_traits>)
 SYMBOL(conj, std::, <complex>)
 SYMBOL(conjunction, std::, <type_traits>)
 SYMBOL(conjunction_v, std::, <type_traits>)
+SYMBOL(const_iterator, std::, <iterator>)
 SYMBOL(const_mem_fun1_ref_t, std::, <functional>)
 SYMBOL(const_mem_fun1_t, std::, <functional>)
 SYMBOL(const_mem_fun_ref_t, std::, <functional>)
 SYMBOL(const_mem_fun_t, std::, <functional>)
 SYMBOL(const_pointer_cast, std::, <memory>)
+SYMBOL(const_sentinel, std::, <iterator>)
 SYMBOL(construct_at, std::, <memory>)
 SYMBOL(constructible_from, std::, <concepts>)
 SYMBOL(contiguous_iterator, std::, <iterator>)
@@ -1019,6 +1022,7 @@ SYMBOL(deci, std::, <ratio>)
 SYMBOL(declare_no_pointers, std::, <memory>)
 SYMBOL(declare_reachable, std::, <memory>)
 SYMBOL(declval, std::, <utility>)
+SYMBOL(default_accessor, std::, <mdspan>)
 SYMBOL(default_delete, std::, <memory>)
 SYMBOL(default_initializable, std::, <concepts>)
 SYMBOL(default_random_engine, std::, <random>)
@@ -1040,6 +1044,7 @@ SYMBOL(destroy_n, std::, <memory>)
 SYMBOL(destroying_delete, std::, <new>)
 SYMBOL(destroying_delete_t, std::, <new>)
 SYMBOL(destructible, std::, <concepts>)
+SYMBOL(dextents, std::, <mdspan>)
 SYMBOL(
diff time, std::, <ctime>)
 SYMBOL(
diff time, None, <ctime>)
 SYMBOL(
diff time, None, <time.h>)
@@ -1084,8 +1089,6 @@ SYMBOL(equal_to, std::, <functional>)
 SYMBOL(equality_comparable, std::, <concepts>)
 SYMBOL(equality_comparable_with, std::, <concepts>)
 SYMBOL(equivalence_relation, std::, <concepts>)
-SYMBOL(erase, std::, <vector>)
-SYMBOL(erase_if, std::, <vector>)
 SYMBOL(erf, std::, <cmath>)
 SYMBOL(erf, None, <cmath>)
 SYMBOL(erf, None, <math.h>)
@@ -1128,6 +1131,7 @@ SYMBOL(exp2f, None, <math.h>)
 SYMBOL(exp2l, std::, <cmath>)
 SYMBOL(exp2l, None, <cmath>)
 SYMBOL(exp2l, None, <math.h>)
+SYMBOL(expected, std::, <expected>)
 SYMBOL(expf, std::, <cmath>)
 SYMBOL(expf, None, <cmath>)
 SYMBOL(expf, None, <math.h>)
@@ -1149,6 +1153,7 @@ SYMBOL(expm1l, None, <math.h>)
 SYMBOL(exponential_distribution, std::, <random>)
 SYMBOL(extent, std::, <type_traits>)
 SYMBOL(extent_v, std::, <type_traits>)
+SYMBOL(extents, std::, <mdspan>)
 SYMBOL(extreme_value_distribution, std::, <random>)
 SYMBOL(fabs, std::, <cmath>)
 SYMBOL(fabs, None, <cmath>)
@@ -1249,6 +1254,10 @@ SYMBOL(find_if_not, std::, <algorithm>)
 SYMBOL(fisher_f_distribution, std::, <random>)
 SYMBOL(fixed, std::, <ios>)
 SYMBOL(fixed, std::, <iostream>)
+SYMBOL(flat_map, std::, <flat_map>)
+SYMBOL(flat_multimap, std::, <flat_map>)
+SYMBOL(flat_multiset, std::, <flat_set>)
+SYMBOL(flat_set, std::, <flat_set>)
 SYMBOL(float_denorm_style, std::, <limits>)
 SYMBOL(float_round_style, std::, <limits>)
 SYMBOL(float_t, std::, <cmath>)
@@ -1314,6 +1323,7 @@ SYMBOL(format_args, std::, <format>)
 SYMBOL(format_context, std::, <format>)
 SYMBOL(format_error, std::, <format>)
 SYMBOL(format_parse_context, std::, <format>)
+SYMBOL(format_string, std::, <format>)
 SYMBOL(format_to, std::, <format>)
 SYMBOL(format_to_n, std::, <format>)
 SYMBOL(format_to_n_result, std::, <format>)
@@ -1410,6 +1420,7 @@ SYMBOL(gcd, std::, <numeric>)
 SYMBOL(generate, std::, <algorithm>)
 SYMBOL(generate_canonical, std::, <random>)
 SYMBOL(generate_n, std::, <algorithm>)
+SYMBOL(generator, std::, <generator>)
 SYMBOL(generic_category, std::, <system_error>)
 SYMBOL(geometric_distribution, std::, <random>)
 SYMBOL(get_deleter, std::, <memory>)
@@ -1456,7 +1467,6 @@ SYMBOL(has_unique_object_representations, std::, <type_traits>)
 SYMBOL(has_unique_object_representations_v, std::, <type_traits>)
 SYMBOL(has_virtual_destructor, std::, <type_traits>)
 SYMBOL(has_virtual_destructor_v, std::, <type_traits>)
-SYMBOL(hash, std::, <functional>)
 SYMBOL(hecto, std::, <ratio>)
 SYMBOL(hermite, std::, <cmath>)
 SYMBOL(hermitef, std::, <cmath>)
@@ -1510,6 +1520,8 @@ SYMBOL(inclusive_scan, std::, <numeric>)
 SYMBOL(incrementable, std::, <iterator>)
 SYMBOL(incrementable_traits, std::, <iterator>)
 SYMBOL(independent_bits_engine, std::, <random>)
+SYMBOL(index_sequence, std::, <utility>)
+SYMBOL(index_sequence_for, std::, <utility>)
 SYMBOL(indirect_array, std::, <valarray>)
 SYMBOL(indirect_binary_predicate, std::, <iterator>)
 SYMBOL(indirect_equivalence_relation, std::, <iterator>)
@@ -1663,6 +1675,7 @@ SYMBOL(is_gt, std::, <compare>)
 SYMBOL(is_gteq, std::, <compare>)
 SYMBOL(is_heap, std::, <algorithm>)
 SYMBOL(is_heap_until, std::, <algorithm>)
+SYMBOL(is_implicit_lifetime, std::, <type_traits>)
 SYMBOL(is_integral, std::, <type_traits>)
 SYMBOL(is_integral_v, std::, <type_traits>)
 SYMBOL(is_invocable, std::, <type_traits>)
@@ -1781,6 +1794,7 @@ SYMBOL(is_void, std::, <type_traits>)
 SYMBOL(is_void_v, std::, <type_traits>)
 SYMBOL(is_volatile, std::, <type_traits>)
 SYMBOL(is_volatile_v, std::, <type_traits>)
+SYMBOL(is_within_lifetime, std::, <type_traits>)
 SYMBOL(isalnum, std::, <cctype>)
 SYMBOL(isalnum, None, <cctype>)
 SYMBOL(isalnum, None, <ctype.h>)
@@ -1849,6 +1863,7 @@ SYMBOL(istreambuf_iterator, std::, <iosfwd>)
 SYMBOL(istringstream, std::, <sstream>)
 SYMBOL(istringstream, std::, <iosfwd>)
 SYMBOL(istrstream, std::, <strstream>)
+SYMBOL(istrstream, std::, <strstream>)
 SYMBOL(isunordered, std::, <cmath>)
 SYMBOL(isunordered, None, <cmath>)
 SYMBOL(isunordered, None, <math.h>)
@@ -1922,6 +1937,9 @@ SYMBOL(laguerrel, std::, <cmath>)
 SYMBOL(latch, std::, <latch>)
 SYMBOL(launch, std::, <future>)
 SYMBOL(launder, std::, <new>)
+SYMBOL(layout_left, std::, <mdspan>)
+SYMBOL(layout_right, std::, <mdspan>)
+SYMBOL(layout_stride, std::, <mdspan>)
 SYMBOL(lcm, std::, <numeric>)
 SYMBOL(lconv, std::, <clocale>)
 SYMBOL(lconv, None, <clocale>)
@@ -2071,10 +2089,15 @@ SYMBOL(lroundf, None, <math.h>)
 SYMBOL(lroundl, std::, <cmath>)
 SYMBOL(lroundl, None, <cmath>)
 SYMBOL(lroundl, None, <math.h>)
+SYMBOL(make_any, std::, <any>)
+SYMBOL(make_const_iterator, std::, <iterator>)
+SYMBOL(make_const_sentinel, std::, <iterator>)
 SYMBOL(make_exception_ptr, std::, <exception>)
 SYMBOL(make_format_args, std::, <format>)
 SYMBOL(make_from_tuple, std::, <tuple>)
 SYMBOL(make_heap, std::, <algorithm>)
+SYMBOL(make_index_sequence, std::, <utility>)
+SYMBOL(make_integer_sequence, std::, <utility>)
 SYMBOL(make_move_iterator, std::, <iterator>)
 SYMBOL(make_obj_using_allocator, std::, <memory>)
 SYMBOL(make_optional, std::, <optional>)
@@ -2131,6 +2154,7 @@ SYMBOL(mbstowcs, None, <stdlib.h>)
 SYMBOL(mbtowc, std::, <cstdlib>)
 SYMBOL(mbtowc, None, <cstdlib>)
 SYMBOL(mbtowc, None, <stdlib.h>)
+SYMBOL(mdspan, std::, <mdspan>)
 SYMBOL(mega, std::, <ratio>)
 SYMBOL(mem_fn, std::, <functional>)
 SYMBOL(mem_fun, std::, <functional>)
@@ -2198,7 +2222,6 @@ SYMBOL(moneypunct, std::, <locale>)
 SYMBOL(moneypunct_byname, std::, <locale>)
 SYMBOL(monostate, std::, <variant>)
 SYMBOL(movable, std::, <concepts>)
-SYMBOL(move_backward, std::, <algorithm>)
 SYMBOL(move_constructible, std::, <concepts>)
 SYMBOL(move_if_noexcept, std::, <utility>)
 SYMBOL(move_iterator, std::, <iterator>)
@@ -2302,6 +2325,7 @@ SYMBOL(oct, std::, <iostream>)
 SYMBOL(ofstream, std::, <fstream>)
 SYMBOL(ofstream, std::, <iosfwd>)
 SYMBOL(once_flag, std::, <mutex>)
+SYMBOL(op, std::, <functional>)
 SYMBOL(open_mode, std::, <ios>)
 SYMBOL(open_mode, std::, <iostream>)
 SYMBOL(optional, std::, <optional>)
@@ -2316,6 +2340,7 @@ SYMBOL(ostreambuf_iterator, std::, <iosfwd>)
 SYMBOL(ostringstream, std::, <sstream>)
 SYMBOL(ostringstream, std::, <iosfwd>)
 SYMBOL(ostrstream, std::, <strstream>)
+SYMBOL(ostrstream, std::, <strstream>)
 SYMBOL(osyncstream, std::, <syncstream>)
 SYMBOL(osyncstream, std::, <iosfwd>)
 SYMBOL(out_of_range, std::, <stdexcept>)
@@ -2365,9 +2390,11 @@ SYMBOL(predicate, std::, <concepts>)
 SYMBOL(preferred, std::, <memory>)
 SYMBOL(prev, std::, <iterator>)
 SYMBOL(prev_permutation, std::, <algorithm>)
+SYMBOL(print, std::, <print>)
 SYMBOL(printf, std::, <cstdio>)
 SYMBOL(printf, None, <cstdio>)
 SYMBOL(printf, None, <stdio.h>)
+SYMBOL(println, std::, <print>)
 SYMBOL(priority_queue, std::, <queue>)
 SYMBOL(proj, std::, <complex>)
 SYMBOL(projected, std::, <iterator>)
@@ -2397,6 +2424,8 @@ SYMBOL(putwchar, None, <wchar.h>)
 SYMBOL(qsort, std::, <cstdlib>)
 SYMBOL(qsort, None, <cstdlib>)
 SYMBOL(qsort, None, <stdlib.h>)
+SYMBOL(quecto, std::, <ratio>)
+SYMBOL(quetta, std::, <ratio>)
 SYMBOL(queue, std::, <queue>)
 SYMBOL(quick_exit, std::, <cstdlib>)
 SYMBOL(quick_exit, None, <cstdlib>)
@@ -2445,6 +2474,8 @@ SYMBOL(recursive_mutex, std::, <mutex>)
 SYMBOL(recursive_timed_mutex, std::, <mutex>)
 SYMBOL(reduce, std::, <numeric>)
 SYMBOL(ref, std::, <functional>)
+SYMBOL(reference_constructs_from_temporary, std::, <type_traits>)
+SYMBOL(reference_converts_from_temporary, std::, <type_traits>)
 SYMBOL(reference_wrapper, std::, <functional>)
 SYMBOL(regex, std::, <regex>)
 SYMBOL(regex_error, std::, <regex>)
@@ -2455,9 +2486,9 @@ SYMBOL(regex_search, std::, <regex>)
 SYMBOL(regex_token_iterator, std::, <regex>)
 SYMBOL(regex_traits, std::, <regex>)
 SYMBOL(regular, std::, <concepts>)
-SYMBOL(regular_invocable, std::, <concepts>)
 SYMBOL(reinterpret_pointer_cast, std::, <memory>)
 SYMBOL(relation, std::, <concepts>)
+SYMBOL(relaxed, std::, <memory>)
 SYMBOL(remainder, std::, <cmath>)
 SYMBOL(remainder, None, <cmath>)
 SYMBOL(remainder, None, <math.h>)
@@ -2528,6 +2559,8 @@ SYMBOL(rintf, None, <math.h>)
 SYMBOL(rintl, std::, <cmath>)
 SYMBOL(rintl, None, <cmath>)
 SYMBOL(rintl, None, <math.h>)
+SYMBOL(ronna, std::, <ratio>)
+SYMBOL(ronto, std::, <ratio>)
 SYMBOL(rotate, std::, <algorithm>)
 SYMBOL(rotate_copy, std::, <algorithm>)
 SYMBOL(rotl, std::, <bit>)
@@ -2705,6 +2738,7 @@ SYMBOL(stable_sort, std::, <algorithm>)
 SYMBOL(stack, std::, <stack>)
 SYMBOL(stacktrace, std::, <stacktrace>)
 SYMBOL(stacktrace_entry, std::, <stacktrace>)
+SYMBOL(start_lifetime_as, std::, <memory>)
 SYMBOL(static_pointer_cast, std::, <memory>)
 SYMBOL(stod, std::, <string>)
 SYMBOL(stof, std::, <string>)
@@ -2785,6 +2819,8 @@ SYMBOL(strstr, std::, <cstring>)
 SYMBOL(strstr, None, <cstring>)
 SYMBOL(strstr, None, <string.h>)
 SYMBOL(strstream, std::, <strstream>)
+SYMBOL(strstream, std::, <strstream>)
+SYMBOL(strstreambuf, std::, <strstream>)
 SYMBOL(strstreambuf, std::, <strstream>)
 SYMBOL(strtod, std::, <cstdlib>)
 SYMBOL(strtod, None, <cstdlib>)
@@ -3017,6 +3053,9 @@ SYMBOL(undeclare_reachable, std::, <memory>)
 SYMBOL(underflow_error, std::, <stdexcept>)
 SYMBOL(underlying_type, std::, <type_traits>)
 SYMBOL(underlying_type_t, std::, <type_traits>)
+SYMBOL(unexpect, std::, <expected>)
+SYMBOL(unexpect_t, std::, <expected>)
+SYMBOL(unexpected, std::, <expected>)
 SYMBOL(unexpected_handler, std::, <exception>)
 SYMBOL(ungetc, std::, <cstdio>)
 SYMBOL(ungetc, None, <cstdio>)
@@ -3087,6 +3126,8 @@ SYMBOL(vfwscanf, None, <wchar.h>)
 SYMBOL(visit, std::, <variant>)
 SYMBOL(visit_format_arg, std::, <format>)
 SYMBOL(void_t, std::, <type_traits>)
+SYMBOL(vprint_nonunicode, std::, <print>)
+SYMBOL(vprint_unicode, std::, <print>)
 SYMBOL(vprintf, std::, <cstdio>)
 SYMBOL(vprintf, None, <cstdio>)
 SYMBOL(vprintf, None, <stdio.h>)
@@ -3239,6 +3280,7 @@ SYMBOL(wfilebuf, std::, <iosfwd>)
 SYMBOL(wformat_args, std::, <format>)
 SYMBOL(wformat_context, std::, <format>)
 SYMBOL(wformat_parse_context, std::, <format>)
+SYMBOL(wformat_string, std::, <format>)
 SYMBOL(wfstream, std::, <fstream>)
 SYMBOL(wfstream, std::, <iosfwd>)
 SYMBOL(wifstream, std::, <fstream>)
@@ -3338,6 +3380,7 @@ SYMBOL(Tuesday, std::chrono::, <chrono>)
 SYMBOL(Wednesday, std::chrono::, <chrono>)
 SYMBOL(abs, std::chrono::, <chrono>)
 SYMBOL(ambiguous_local_time, std::chrono::, <chrono>)
+SYMBOL(ceil, std::chrono::, <chrono>)
 SYMBOL(choose, std::chrono::, <chrono>)
 SYMBOL(clock_cast, std::chrono::, <chrono>)
 SYMBOL(clock_time_conversion, std::chrono::, <chrono>)
@@ -3349,6 +3392,8 @@ SYMBOL(duration_values, std::chrono::, <chrono>)
 SYMBOL(file_clock, std::chrono::, <chrono>)
 SYMBOL(file_seconds, std::chrono::, <chrono>)
 SYMBOL(file_time, std::chrono::, <chrono>)
+SYMBOL(floor, std::chrono::, <chrono>)
+SYMBOL(from_stream, std::chrono::, <chrono>)
 SYMBOL(get_leap_second_info, std::chrono::, <chrono>)
 SYMBOL(gps_clock, std::chrono::, <chrono>)
 SYMBOL(gps_seconds, std::chrono::, <chrono>)
@@ -3378,11 +3423,11 @@ SYMBOL(minutes, std::chrono::, <chrono>)
 SYMBOL(month, std::chrono::, <chrono>)
 SYMBOL(month_day, std::chrono::, <chrono>)
 SYMBOL(month_day_last, std::chrono::, <chrono>)
-SYMBOL(month_weekday, std::chrono::, <chrono>)
 SYMBOL(month_weekday_last, std::chrono::, <chrono>)
 SYMBOL(nanoseconds, std::chrono::, <chrono>)
 SYMBOL(nonexistent_local_time, std::chrono::, <chrono>)
 SYMBOL(parse, std::chrono::, <chrono>)
+SYMBOL(round, std::chrono::, <chrono>)
 SYMBOL(seconds, std::chrono::, <chrono>)
 SYMBOL(steady_clock, std::chrono::, <chrono>)
 SYMBOL(sys_days, std::chrono::, <chrono>)
@@ -3425,6 +3470,7 @@ SYMBOL(sequenced_policy, std::execution::, <execution>)
 SYMBOL(unseq, std::execution::, <execution>)
 SYMBOL(unsequenced_policy, std::execution::, <execution>)
 SYMBOL(absolute, std::filesystem::, <filesystem>)
+SYMBOL(begin, std::filesystem::, <filesystem>)
 SYMBOL(canonical, std::filesystem::, <filesystem>)
 SYMBOL(copy, std::filesystem::, <filesystem>)
 SYMBOL(copy_file, std::filesystem::, <filesystem>)
@@ -3439,6 +3485,7 @@ SYMBOL(current_path, std::filesystem::, <filesystem>)
 SYMBOL(directory_entry, std::filesystem::, <filesystem>)
 SYMBOL(directory_iterator, std::filesystem::, <filesystem>)
 SYMBOL(directory_options, std::filesystem::, <filesystem>)
+SYMBOL(end, std::filesystem::, <filesystem>)
 SYMBOL(equivalent, std::filesystem::, <filesystem>)
 SYMBOL(exists, std::filesystem::, <filesystem>)
 SYMBOL(file_size, std::filesystem::, <filesystem>)
@@ -3539,21 +3586,22 @@ SYMBOL(wcmatch, std::pmr::, <regex>)
 SYMBOL(wsmatch, std::pmr::, <regex>)
 SYMBOL(wstring, std::pmr::, <string>)
 SYMBOL(adjacent_find, std::ranges::, <algorithm>)
+SYMBOL(adjacent_transform_view, std::ranges::, <ranges>)
+SYMBOL(adjacent_view, std::ranges::, <ranges>)
 SYMBOL(advance, std::ranges::, <iterator>)
 SYMBOL(all_of, std::ranges::, <algorithm>)
 SYMBOL(any_of, std::ranges::, <algorithm>)
 SYMBOL(as_const_view, std::ranges::, <ranges>)
 SYMBOL(as_rvalue_view, std::ranges::, <ranges>)
 SYMBOL(basic_istream_view, std::ranges::, <ranges>)
-SYMBOL(begin, std::ranges::, <ranges>)
 SYMBOL(bidirectional_range, std::ranges::, <ranges>)
 SYMBOL(binary_transform_result, std::ranges::, <algorithm>)
 SYMBOL(borrowed_iterator_t, std::ranges::, <ranges>)
 SYMBOL(borrowed_range, std::ranges::, <ranges>)
 SYMBOL(borrowed_subrange_t, std::ranges::, <ranges>)
-SYMBOL(cbegin, std::ranges::, <ranges>)
-SYMBOL(cdata, std::ranges::, <ranges>)
-SYMBOL(cend, std::ranges::, <ranges>)
+SYMBOL(cartesian_product_view, std::ranges::, <ranges>)
+SYMBOL(chunk_by_view, std::ranges::, <ranges>)
+SYMBOL(chunk_view, std::ranges::, <ranges>)
 SYMBOL(clamp, std::ranges::, <algorithm>)
 SYMBOL(common_range, std::ranges::, <ranges>)
 SYMBOL(common_view, std::ranges::, <ranges>)
@@ -3573,10 +3621,7 @@ SYMBOL(copy_n_result, std::ranges::, <algorithm>)
 SYMBOL(copy_result, std::ranges::, <algorithm>)
 SYMBOL(count, std::ranges::, <algorithm>)
 SYMBOL(count_if, std::ranges::, <algorithm>)
-SYMBOL(crbegin, std::ranges::, <ranges>)
-SYMBOL(crend, std::ranges::, <ranges>)
 SYMBOL(dangling, std::ranges::, <ranges>)
-SYMBOL(data, std::ranges::, <ranges>)
 SYMBOL(destroy, std::ranges::, <memory>)
 SYMBOL(destroy_at, std::ranges::, <memory>)
 SYMBOL(destroy_n, std::ranges::, <memory>)
@@ -3585,11 +3630,9 @@ SYMBOL(distance, std::ranges::, <iterator>)
 SYMBOL(drop_view, std::ranges::, <ranges>)
 SYMBOL(drop_while_view, std::ranges::, <ranges>)
 SYMBOL(elements_view, std::ranges::, <ranges>)
-SYMBOL(empty, std::ranges::, <ranges>)
 SYMBOL(empty_view, std::ranges::, <ranges>)
 SYMBOL(enable_borrowed_range, std::ranges::, <ranges>)
 SYMBOL(enable_view, std::ranges::, <ranges>)
-SYMBOL(end, std::ranges::, <ranges>)
 SYMBOL(ends_with, std::ranges::, <algorithm>)
 SYMBOL(equal, std::ranges::, <algorithm>)
 SYMBOL(equal_to, std::ranges::, <functional>)
@@ -3604,6 +3647,12 @@ SYMBOL(find_if_not, std::ranges::, <algorithm>)
 SYMBOL(find_last, std::ranges::, <algorithm>)
 SYMBOL(find_last_if, std::ranges::, <algorithm>)
 SYMBOL(find_last_if_not, std::ranges::, <algorithm>)
+SYMBOL(fold_left, std::ranges::, <algorithm>)
+SYMBOL(fold_left_first, std::ranges::, <algorithm>)
+SYMBOL(fold_left_first_with_iter, std::ranges::, <algorithm>)
+SYMBOL(fold_left_with_iter, std::ranges::, <algorithm>)
+SYMBOL(fold_right, std::ranges::, <algorithm>)
+SYMBOL(fold_right_last, std::ranges::, <algorithm>)
 SYMBOL(for_each, std::ranges::, <algorithm>)
 SYMBOL(for_each_n, std::ranges::, <algorithm>)
 SYMBOL(for_each_n_result, std::ranges::, <algorithm>)
@@ -3611,6 +3660,7 @@ SYMBOL(for_each_result, std::ranges::, <algorithm>)
 SYMBOL(forward_range, std::ranges::, <ranges>)
 SYMBOL(generate, std::ranges::, <algorithm>)
 SYMBOL(generate_n, std::ranges::, <algorithm>)
+SYMBOL(get, std::ranges::, <ranges>)
 SYMBOL(greater, std::ranges::, <functional>)
 SYMBOL(greater_equal, std::ranges::, <functional>)
 SYMBOL(in_found_result, std::ranges::, <algorithm>)
@@ -3684,13 +3734,13 @@ SYMBOL(prev_permutation_result, std::ranges::, <algorithm>)
 SYMBOL(push_heap, std::ranges::, <algorithm>)
 SYMBOL(random_access_range, std::ranges::, <ranges>)
 SYMBOL(range, std::ranges::, <ranges>)
+SYMBOL(range_adaptor_closure, std::ranges::, <ranges>)
 SYMBOL(range_const_reference_t, std::ranges::, <ranges>)
 SYMBOL(range_
diff erence_t, std::ranges::, <ranges>)
 SYMBOL(range_reference_t, std::ranges::, <ranges>)
 SYMBOL(range_rvalue_reference_t, std::ranges::, <ranges>)
 SYMBOL(range_size_t, std::ranges::, <ranges>)
 SYMBOL(range_value_t, std::ranges::, <ranges>)
-SYMBOL(rbegin, std::ranges::, <ranges>)
 SYMBOL(ref_view, std::ranges::, <ranges>)
 SYMBOL(remove, std::ranges::, <algorithm>)
 SYMBOL(remove_copy, std::ranges::, <algorithm>)
@@ -3698,7 +3748,7 @@ SYMBOL(remove_copy_if, std::ranges::, <algorithm>)
 SYMBOL(remove_copy_if_result, std::ranges::, <algorithm>)
 SYMBOL(remove_copy_result, std::ranges::, <algorithm>)
 SYMBOL(remove_if, std::ranges::, <algorithm>)
-SYMBOL(rend, std::ranges::, <ranges>)
+SYMBOL(repeat_view, std::ranges::, <ranges>)
 SYMBOL(replace, std::ranges::, <algorithm>)
 SYMBOL(replace_copy, std::ranges::, <algorithm>)
 SYMBOL(replace_copy_if, std::ranges::, <algorithm>)
@@ -3728,15 +3778,15 @@ SYMBOL(shift_left, std::ranges::, <algorithm>)
 SYMBOL(shift_right, std::ranges::, <algorithm>)
 SYMBOL(shuffle, std::ranges::, <algorithm>)
 SYMBOL(single_view, std::ranges::, <ranges>)
-SYMBOL(size, std::ranges::, <ranges>)
 SYMBOL(sized_range, std::ranges::, <ranges>)
+SYMBOL(slide_view, std::ranges::, <ranges>)
 SYMBOL(sort, std::ranges::, <algorithm>)
 SYMBOL(sort_heap, std::ranges::, <algorithm>)
 SYMBOL(split_view, std::ranges::, <ranges>)
-SYMBOL(ssize, std::ranges::, <ranges>)
 SYMBOL(stable_partition, std::ranges::, <algorithm>)
 SYMBOL(stable_sort, std::ranges::, <algorithm>)
 SYMBOL(starts_with, std::ranges::, <algorithm>)
+SYMBOL(stride_view, std::ranges::, <ranges>)
 SYMBOL(subrange, std::ranges::, <ranges>)
 SYMBOL(subrange_kind, std::ranges::, <ranges>)
 SYMBOL(swap, std::ranges::, <concepts>)
@@ -3773,10 +3823,15 @@ SYMBOL(viewable_range, std::ranges::, <ranges>)
 SYMBOL(wistream_view, std::ranges::, <ranges>)
 SYMBOL(zip_transform_view, std::ranges::, <ranges>)
 SYMBOL(zip_view, std::ranges::, <ranges>)
+SYMBOL(adjacent, std::ranges::views::, <ranges>)
+SYMBOL(adjacent_transform, std::ranges::views::, <ranges>)
 SYMBOL(all, std::ranges::views::, <ranges>)
 SYMBOL(all_t, std::ranges::views::, <ranges>)
 SYMBOL(as_const, std::ranges::views::, <ranges>)
 SYMBOL(as_rvalue, std::ranges::views::, <ranges>)
+SYMBOL(cartesian_product, std::ranges::views::, <ranges>)
+SYMBOL(chunk, std::ranges::views::, <ranges>)
+SYMBOL(chunk_by, std::ranges::views::, <ranges>)
 SYMBOL(common, std::ranges::views::, <ranges>)
 SYMBOL(counted, std::ranges::views::, <ranges>)
 SYMBOL(drop, std::ranges::views::, <ranges>)
@@ -3791,9 +3846,14 @@ SYMBOL(join, std::ranges::views::, <ranges>)
 SYMBOL(join_with, std::ranges::views::, <ranges>)
 SYMBOL(keys, std::ranges::views::, <ranges>)
 SYMBOL(lazy_split, std::ranges::views::, <ranges>)
+SYMBOL(pairwise, std::ranges::views::, <ranges>)
+SYMBOL(pairwise_transform, std::ranges::views::, <ranges>)
+SYMBOL(repeat, std::ranges::views::, <ranges>)
 SYMBOL(reverse, std::ranges::views::, <ranges>)
 SYMBOL(single, std::ranges::views::, <ranges>)
+SYMBOL(slide, std::ranges::views::, <ranges>)
 SYMBOL(split, std::ranges::views::, <ranges>)
+SYMBOL(stride, std::ranges::views::, <ranges>)
 SYMBOL(take, std::ranges::views::, <ranges>)
 SYMBOL(take_while, std::ranges::views::, <ranges>)
 SYMBOL(transform, std::ranges::views::, <ranges>)
@@ -3844,10 +3904,15 @@ SYMBOL(get_id, std::this_thread::, <thread>)
 SYMBOL(sleep_for, std::this_thread::, <thread>)
 SYMBOL(sleep_until, std::this_thread::, <thread>)
 SYMBOL(yield, std::this_thread::, <thread>)
+SYMBOL(adjacent, std::views::, <ranges>)
+SYMBOL(adjacent_transform, std::views::, <ranges>)
 SYMBOL(all, std::views::, <ranges>)
 SYMBOL(all_t, std::views::, <ranges>)
 SYMBOL(as_const, std::views::, <ranges>)
 SYMBOL(as_rvalue, std::views::, <ranges>)
+SYMBOL(cartesian_product, std::views::, <ranges>)
+SYMBOL(chunk, std::views::, <ranges>)
+SYMBOL(chunk_by, std::views::, <ranges>)
 SYMBOL(common, std::views::, <ranges>)
 SYMBOL(counted, std::views::, <ranges>)
 SYMBOL(drop, std::views::, <ranges>)
@@ -3862,9 +3927,14 @@ SYMBOL(join, std::views::, <ranges>)
 SYMBOL(join_with, std::views::, <ranges>)
 SYMBOL(keys, std::views::, <ranges>)
 SYMBOL(lazy_split, std::views::, <ranges>)
+SYMBOL(pairwise, std::views::, <ranges>)
+SYMBOL(pairwise_transform, std::views::, <ranges>)
+SYMBOL(repeat, std::views::, <ranges>)
 SYMBOL(reverse, std::views::, <ranges>)
 SYMBOL(single, std::views::, <ranges>)
+SYMBOL(slide, std::views::, <ranges>)
 SYMBOL(split, std::views::, <ranges>)
+SYMBOL(stride, std::views::, <ranges>)
 SYMBOL(take, std::views::, <ranges>)
 SYMBOL(take_while, std::views::, <ranges>)
 SYMBOL(transform, std::views::, <ranges>)

diff  --git a/clang/tools/include-mapping/cppreference_parser.py b/clang/tools/include-mapping/cppreference_parser.py
index f2ea55384fac80..9101f3dbff0f94 100644
--- a/clang/tools/include-mapping/cppreference_parser.py
+++ b/clang/tools/include-mapping/cppreference_parser.py
@@ -7,7 +7,7 @@
 #
 # ===------------------------------------------------------------------------===#
 
-from bs4 import BeautifulSoup, NavigableString
+from bs4 import BeautifulSoup, NavigableString, Tag
 
 import collections
 import multiprocessing
@@ -40,7 +40,7 @@ def _HasClass(tag, *classes):
     return False
 
 
-def _ParseSymbolPage(symbol_page_html, symbol_name):
+def _ParseSymbolPage(symbol_page_html, symbol_name, qual_name):
     """Parse symbol page and retrieve the include header defined in this page.
     The symbol page provides header for the symbol, specifically in
     "Defined in header <header>" section. An example:
@@ -69,7 +69,9 @@ def _ParseSymbolPage(symbol_page_html, symbol_name):
                 was_decl = True
                 # Symbols are in the first cell.
                 found_symbols = row.find("td").stripped_strings
-                if not symbol_name in found_symbols:
+                if not any(
+                    sym == symbol_name or sym == qual_name for sym in found_symbols
+                ):
                     continue
                 headers.update(current_headers)
             elif _HasClass(row, "t-dsc-header"):
@@ -89,6 +91,22 @@ def _ParseSymbolPage(symbol_page_html, symbol_name):
     return headers or all_headers
 
 
+def _ParseSymbolVariant(caption):
+    if not (isinstance(caption, NavigableString) and "(" in caption):
+        return None
+
+    if ")" in caption.text:  # (locale), (algorithm), etc.
+        return caption.text.strip(" ()")
+
+    second_part = caption.next_sibling
+    if isinstance(second_part, Tag) and second_part.name == "code":
+        # (<code>std::complex</code>), etc.
+        third_part = second_part.next_sibling
+        if isinstance(third_part, NavigableString) and third_part.text.startswith(")"):
+            return second_part.text
+    return None
+
+
 def _ParseIndexPage(index_page_html):
     """Parse index page.
     The index page lists all std symbols and hrefs to their detailed pages
@@ -107,9 +125,7 @@ def _ParseIndexPage(index_page_html):
         # This accidentally accepts begin/end despite the (iterator) caption: the
         # (since C++11) note is first. They are good symbols, so the bug is unfixed.
         caption = symbol_href.next_sibling
-        variant = None
-        if isinstance(caption, NavigableString) and "(" in caption:
-            variant = caption.text.strip(" ()")
+        variant = _ParseSymbolVariant(caption)
         symbol_tt = symbol_href.find("tt")
         if symbol_tt:
             symbols.append(
@@ -122,9 +138,9 @@ def _ParseIndexPage(index_page_html):
     return symbols
 
 
-def _ReadSymbolPage(path, name):
+def _ReadSymbolPage(path, name, qual_name):
     with open(path) as f:
-        return _ParseSymbolPage(f.read(), name)
+        return _ParseSymbolPage(f.read(), name, qual_name)
 
 
 def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept):
@@ -146,9 +162,8 @@ def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept):
         for symbol_name, symbol_page_path, variant in _ParseIndexPage(f.read()):
             # Variant symbols (e.g. the std::locale version of isalpha) add ambiguity.
             # FIXME: use these as a fallback rather than ignoring entirely.
-            variants_for_symbol = variants_to_accept.get(
-                (namespace or "") + symbol_name, ()
-            )
+            qualified_symbol_name = (namespace or "") + symbol_name
+            variants_for_symbol = variants_to_accept.get(qualified_symbol_name, ())
             if variant and variant not in variants_for_symbol:
                 continue
             path = os.path.join(root_dir, symbol_page_path)
@@ -156,7 +171,9 @@ def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept):
                 results.append(
                     (
                         symbol_name,
-                        pool.apply_async(_ReadSymbolPage, (path, symbol_name)),
+                        pool.apply_async(
+                            _ReadSymbolPage, (path, symbol_name, qualified_symbol_name)
+                        ),
                     )
                 )
             else:
@@ -192,6 +209,16 @@ def GetSymbols(parse_pages):
     variants_to_accept = {
         # std::remove<> has variant algorithm.
         "std::remove": ("algorithm"),
+        # These functions don't have a generic version, and all variants are defined in <chrono>
+        "std::chrono::abs": ("std::chrono::duration"),
+        "std::chrono::ceil": ("std::chrono::duration"),
+        "std::chrono::floor": ("std::chrono::duration"),
+        "std::chrono::from_stream": ("std::chrono::day"),
+        "std::chrono::round": ("std::chrono::duration"),
+        # Same, but in <filesystem>
+        "std::filesystem::begin": ("std::filesystem::directory_iterator"),
+        "std::filesystem::end": ("std::filesystem::directory_iterator"),
+        "std::ranges::get": ("std::ranges::subrange"),
     }
     symbols = []
     # Run many workers to process individual symbol pages under the symbol index.


        


More information about the cfe-commits mailing list