hokein updated this revision to Diff 187835.
hokein marked 6 inline comments as done.
hokein added a comment.

- address comments
- narrow the scope of this patch -- only emit unique symbols
- add the generator tool


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58345/new/

https://reviews.llvm.org/D58345

Files:
  clangd/StdGen/.gitignore
  clangd/StdGen/Readme.md
  clangd/StdGen/lib/config.js
  clangd/StdGen/lib/main.js
  clangd/StdGen/lib/parse.js
  clangd/StdGen/package.json
  clangd/StdGen/spec/test.js
  clangd/StdSymbolMap.inc
  clangd/index/CanonicalIncludes.cpp

Index: clangd/index/CanonicalIncludes.cpp
===================================================================
--- clangd/index/CanonicalIncludes.cpp
+++ clangd/index/CanonicalIncludes.cpp
@@ -154,6 +154,9 @@
       {"std::uint_least16_t", "<cstdint>"}, // <type_traits> redeclares these
       {"std::uint_least32_t", "<cstdint>"},
       {"std::declval", "<utility>"},
+#define SYMBOL(Name, NameSpace, Header) { #NameSpace#Name, #Header },
+      #include "StdSymbolMap.inc"
+#undef SYMBOL
   };
   for (const auto &Pair : SymbolMap)
     Includes->addSymbolMapping(Pair.first, Pair.second);
Index: clangd/StdSymbolMap.inc
===================================================================
--- /dev/null
+++ clangd/StdSymbolMap.inc
@@ -0,0 +1,1022 @@
+//===-- StdGen'erated file --------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+// Used to build a map (qualified names => include headers) for all symbols from
+// C++ Standard Library (up to C++17).
+//
+// Automatically generated file, do not edit.
+//===----------------------------------------------------------------------===//
+
+SYMBOL(_Exit, std::, <cstdlib>)
+SYMBOL(accumulate, std::, <numeric>)
+SYMBOL(add_const, std::, <type_traits>)
+SYMBOL(add_const_t, std::, <type_traits>)
+SYMBOL(add_cv, std::, <type_traits>)
+SYMBOL(add_cv_t, std::, <type_traits>)
+SYMBOL(add_pointer, std::, <type_traits>)
+SYMBOL(add_pointer_t, std::, <type_traits>)
+SYMBOL(add_lvalue_reference, std::, <type_traits>)
+SYMBOL(add_lvalue_reference_t, std::, <type_traits>)
+SYMBOL(addressof, std::, <memory>)
+SYMBOL(add_rvalue_reference, std::, <type_traits>)
+SYMBOL(add_rvalue_reference_t, std::, <type_traits>)
+SYMBOL(add_volatile, std::, <type_traits>)
+SYMBOL(add_volatile_t, std::, <type_traits>)
+SYMBOL(adjacent_difference, std::, <numeric>)
+SYMBOL(adjacent_find, std::, <algorithm>)
+SYMBOL(adopt_lock, std::, <mutex>)
+SYMBOL(adopt_lock_t, std::, <mutex>)
+SYMBOL(advance, std::, <iterator>)
+SYMBOL(align, std::, <memory>)
+SYMBOL(aligned_alloc, std::, <cstdlib>)
+SYMBOL(aligned_storage, std::, <type_traits>)
+SYMBOL(aligned_storage_t, std::, <type_traits>)
+SYMBOL(aligned_union, std::, <type_traits>)
+SYMBOL(aligned_union_t, std::, <type_traits>)
+SYMBOL(alignment_of, std::, <type_traits>)
+SYMBOL(alignment_of_v, std::, <type_traits>)
+SYMBOL(align_val_t, std::, <new>)
+SYMBOL(all_of, std::, <algorithm>)
+SYMBOL(allocate_shared, std::, <memory>)
+SYMBOL(allocator, std::, <memory>)
+SYMBOL(allocator_arg, std::, <memory>)
+SYMBOL(allocator_arg_t, std::, <memory>)
+SYMBOL(allocator_traits, std::, <memory>)
+SYMBOL(any, std::, <any>)
+SYMBOL(any_of, std::, <algorithm>)
+SYMBOL(apply, std::, <tuple>)
+SYMBOL(arg, std::, <complex>)
+SYMBOL(array, std::, <array>)
+SYMBOL(as_const, std::, <utility>)
+SYMBOL(asctime, std::, <ctime>)
+SYMBOL(async, std::, <future>)
+SYMBOL(at_quick_exit, std::, <cstdlib>)
+SYMBOL(atexit, std::, <cstdlib>)
+SYMBOL(atof, std::, <cstdlib>)
+SYMBOL(atoi, std::, <cstdlib>)
+SYMBOL(atol, std::, <cstdlib>)
+SYMBOL(atoll, std::, <cstdlib>)
+SYMBOL(atomic_compare_exchange_strong, std::, <atomic>)
+SYMBOL(atomic_compare_exchange_strong_explicit, std::, <atomic>)
+SYMBOL(atomic_compare_exchange_weak, std::, <atomic>)
+SYMBOL(atomic_compare_exchange_weak_explicit, std::, <atomic>)
+SYMBOL(atomic_exchange, std::, <atomic>)
+SYMBOL(atomic_exchange_explicit, std::, <atomic>)
+SYMBOL(atomic_fetch_add, std::, <atomic>)
+SYMBOL(atomic_fetch_add_explicit, std::, <atomic>)
+SYMBOL(atomic_fetch_and, std::, <atomic>)
+SYMBOL(atomic_fetch_and_explicit, std::, <atomic>)
+SYMBOL(atomic_fetch_or, std::, <atomic>)
+SYMBOL(atomic_fetch_or_explicit, std::, <atomic>)
+SYMBOL(atomic_fetch_sub, std::, <atomic>)
+SYMBOL(atomic_fetch_sub_explicit, std::, <atomic>)
+SYMBOL(atomic_fetch_xor, std::, <atomic>)
+SYMBOL(atomic_fetch_xor_explicit, std::, <atomic>)
+SYMBOL(atomic_flag, std::, <atomic>)
+SYMBOL(atomic_flag_clear, std::, <atomic>)
+SYMBOL(atomic_flag_clear_explicit, std::, <atomic>)
+SYMBOL(atomic_flag_test_and_set, std::, <atomic>)
+SYMBOL(atomic_flag_test_and_set_explicit, std::, <atomic>)
+SYMBOL(atomic_init, std::, <atomic>)
+SYMBOL(atomic_is_lockfree, std::, <atomic>)
+SYMBOL(atomic_load, std::, <atomic>)
+SYMBOL(atomic_load_explicit, std::, <atomic>)
+SYMBOL(atomic_signal_fence, std::, <atomic>)
+SYMBOL(atomic_store, std::, <atomic>)
+SYMBOL(atomic_store_explicit, std::, <atomic>)
+SYMBOL(atomic_thread_fence, std::, <atomic>)
+SYMBOL(auto_ptr, std::, <memory>)
+SYMBOL(back_inserter, std::, <iterator>)
+SYMBOL(back_insert_iterator, std::, <iterator>)
+SYMBOL(bad_alloc, std::, <new>)
+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_function_call, std::, <functional>)
+SYMBOL(bad_optional_access, std::, <optional>)
+SYMBOL(bad_typeid, std::, <typeinfo>)
+SYMBOL(bad_variant_access, std::, <variant>)
+SYMBOL(bad_weak_ptr, std::, <memory>)
+SYMBOL(basic_ios, std::, <ios>)
+SYMBOL(begin, std::, <iterator>)
+SYMBOL(bernoulli_distribution, std::, <random>)
+SYMBOL(bidirectional_iterator_tag, std::, <iterator>)
+SYMBOL(binary_search, std::, <algorithm>)
+SYMBOL(bind, std::, <functional>)
+SYMBOL(binomial_distribution, std::, <random>)
+SYMBOL(bit_and, std::, <functional>)
+SYMBOL(bit_or, std::, <functional>)
+SYMBOL(bit_not, std::, <functional>)
+SYMBOL(bit_xor, std::, <functional>)
+SYMBOL(bitset, std::, <bitset>)
+SYMBOL(boolalpha, std::, <ios>)
+SYMBOL(boyer_moore_horspool_searcher, std::, <functional>)
+SYMBOL(boyer_moore_searcher, std::, <functional>)
+SYMBOL(bsearch, std::, <cstdlib>)
+SYMBOL(btowc, std::, <cwchar>)
+SYMBOL(byte, std::, <cstddef>)
+SYMBOL(c16rtomb, std::, <cuchar>)
+SYMBOL(c32rtomb, std::, <cuchar>)
+SYMBOL(call_once, std::, <mutex>)
+SYMBOL(calloc, std::, <cstdlib>)
+SYMBOL(cauchy_distribution, std::, <random>)
+SYMBOL(cbegin, std::, <iterator>)
+SYMBOL(cbrt, std::, <cmath>)
+SYMBOL(ceil, std::, <cmath>)
+SYMBOL(cend, std::, <iterator>)
+SYMBOL(cerr, std::, <iostream>)
+SYMBOL(char_traits, std::, <string>)
+SYMBOL(chars_format, std::, <charconv>)
+SYMBOL(chi_squared_distribution, std::, <random>)
+SYMBOL(cin, std::, <iostream>)
+SYMBOL(clamp, std::, <algorithm>)
+SYMBOL(clearerr, std::, <cstdio>)
+SYMBOL(clock, std::, <ctime>)
+SYMBOL(clock_t, std::, <ctime>)
+SYMBOL(clog, std::, <iostream>)
+SYMBOL(codecvt_base, std::, <locale>)
+SYMBOL(codecvt_utf16, std::, <codecvt>)
+SYMBOL(codecvt_utf8, std::, <codecvt>)
+SYMBOL(codecvt_utf8_utf16, std::, <codecvt>)
+SYMBOL(common_type, std::, <type_traits>)
+SYMBOL(common_type_t, std::, <type_traits>)
+SYMBOL(complex, std::, <complex>)
+SYMBOL(conditional, std::, <type_traits>)
+SYMBOL(conditional_t, std::, <type_traits>)
+SYMBOL(condition_variable, std::, <condition_variable>)
+SYMBOL(condition_variable_any, std::, <condition_variable>)
+SYMBOL(conjunction, std::, <type_traits>)
+SYMBOL(conjunction_v, std::, <type_traits>)
+SYMBOL(conj, std::, <complex>)
+SYMBOL(copy, std::, <algorithm>)
+SYMBOL(copy_backward, std::, <algorithm>)
+SYMBOL(copy_if, std::, <algorithm>)
+SYMBOL(copy_n, std::, <algorithm>)
+SYMBOL(copysign, std::, <cmath>)
+SYMBOL(const_pointer_cast, std::, <memory>)
+SYMBOL(count, std::, <algorithm>)
+SYMBOL(count_if, std::, <algorithm>)
+SYMBOL(cout, std::, <iostream>)
+SYMBOL(crbegin, std::, <iterator>)
+SYMBOL(cref, std::, <functional>)
+SYMBOL(cregex_iterator, std::, <regex>)
+SYMBOL(crend, std::, <iterator>)
+SYMBOL(ctime, std::, <ctime>)
+SYMBOL(ctype_base, std::, <locale>)
+SYMBOL(current_exception, std::, <exception>)
+SYMBOL(cv_status, std::, <condition_variable>)
+SYMBOL(data, std::, <iterator>)
+SYMBOL(dec, std::, <ios>)
+SYMBOL(decay, std::, <type_traits>)
+SYMBOL(decay_t, std::, <type_traits>)
+SYMBOL(declare_no_pointers, std::, <memory>)
+SYMBOL(declare_reachable, std::, <memory>)
+SYMBOL(declval, std::, <utility>)
+SYMBOL(default_delete, std::, <memory>)
+SYMBOL(default_searcher, std::, <functional>)
+SYMBOL(defaultfloat, std::, <ios>)
+SYMBOL(defer_lock, std::, <mutex>)
+SYMBOL(defer_lock_t, std::, <mutex>)
+SYMBOL(denorm_absent, std::, <limits>)
+SYMBOL(denorm_indeterminate, std::, <limits>)
+SYMBOL(denorm_present, std::, <limits>)
+SYMBOL(deque, std::, <deque>)
+SYMBOL(destroy, std::, <memory>)
+SYMBOL(destroy_at, std::, <memory>)
+SYMBOL(destroy_n, std::, <memory>)
+SYMBOL(difftime, std::, <ctime>)
+SYMBOL(discrete_distribution, std::, <random>)
+SYMBOL(discard_block_engine, std::, <random>)
+SYMBOL(disjunction, std::, <type_traits>)
+SYMBOL(disjunction_v, std::, <type_traits>)
+SYMBOL(distance, std::, <iterator>)
+SYMBOL(divides, std::, <functional>)
+SYMBOL(domain_error, std::, <stdexcept>)
+SYMBOL(dynamic_pointer_cast, std::, <memory>)
+SYMBOL(empty, std::, <iterator>)
+SYMBOL(enable_if, std::, <type_traits>)
+SYMBOL(enable_if_t, std::, <type_traits>)
+SYMBOL(enable_shared_from_this, std::, <memory>)
+SYMBOL(end, std::, <iterator>)
+SYMBOL(endl, std::, <ostream>)
+SYMBOL(ends, std::, <ostream>)
+SYMBOL(equal, std::, <algorithm>)
+SYMBOL(equal_range, std::, <algorithm>)
+SYMBOL(equal_to, std::, <functional>)
+SYMBOL(erf, std::, <cmath>)
+SYMBOL(erfc, std::, <cmath>)
+SYMBOL(errc, std::, <system_error>)
+SYMBOL(error_category, std::, <system_error>)
+SYMBOL(error_code, std::, <system_error>)
+SYMBOL(error_condition, std::, <system_error>)
+SYMBOL(exception, std::, <exception>)
+SYMBOL(exception_ptr, std::, <exception>)
+SYMBOL(exchange, std::, <utility>)
+SYMBOL(exclusive_scan, std::, <numeric>)
+SYMBOL(exit, std::, <cstdlib>)
+SYMBOL(exp2, std::, <cmath>)
+SYMBOL(expm1, std::, <cmath>)
+SYMBOL(exponential_distribution, std::, <random>)
+SYMBOL(extent, std::, <type_traits>)
+SYMBOL(extent_v, std::, <type_traits>)
+SYMBOL(extreme_value_distribution, std::, <random>)
+SYMBOL(fclose, std::, <cstdio>)
+SYMBOL(fdim, std::, <cmath>)
+SYMBOL(feclearexcept, std::, <cfenv>)
+SYMBOL(fegetenv, std::, <cfenv>)
+SYMBOL(fegetexceptflag, std::, <cfenv>)
+SYMBOL(fegetround, std::, <cfenv>)
+SYMBOL(feholdexcept, std::, <cfenv>)
+SYMBOL(fenv_t, std::, <cfenv>)
+SYMBOL(feof, std::, <cstdio>)
+SYMBOL(feraiseexcept, std::, <cfenv>)
+SYMBOL(ferror, std::, <cstdio>)
+SYMBOL(fesetenv, std::, <cfenv>)
+SYMBOL(fesetexceptflag, std::, <cfenv>)
+SYMBOL(fesetround, std::, <cfenv>)
+SYMBOL(fetestexcept, std::, <cfenv>)
+SYMBOL(feupdateenv, std::, <cfenv>)
+SYMBOL(fexcept_t, std::, <cfenv>)
+SYMBOL(fflush, std::, <cstdio>)
+SYMBOL(fgetc, std::, <cstdio>)
+SYMBOL(fgetpos, std::, <cstdio>)
+SYMBOL(fgets, std::, <cstdio>)
+SYMBOL(fgetwc, std::, <cwchar>)
+SYMBOL(fgetws, std::, <cwchar>)
+SYMBOL(fill, std::, <algorithm>)
+SYMBOL(fill_n, std::, <algorithm>)
+SYMBOL(find, std::, <algorithm>)
+SYMBOL(find_end, std::, <algorithm>)
+SYMBOL(find_first_of, std::, <algorithm>)
+SYMBOL(find_if, std::, <algorithm>)
+SYMBOL(find_if_not, std::, <algorithm>)
+SYMBOL(fisher_f_distribution, std::, <random>)
+SYMBOL(fixed, std::, <ios>)
+SYMBOL(float_denorm_style, std::, <limits>)
+SYMBOL(float_round_style, std::, <limits>)
+SYMBOL(floor, std::, <cmath>)
+SYMBOL(flush, std::, <ostream>)
+SYMBOL(fma, std::, <cmath>)
+SYMBOL(fmax, std::, <cmath>)
+SYMBOL(fmin, std::, <cmath>)
+SYMBOL(fmod, std::, <cmath>)
+SYMBOL(fopen, std::, <cstdio>)
+SYMBOL(for_each, std::, <algorithm>)
+SYMBOL(for_each_n, std::, <algorithm>)
+SYMBOL(forward, std::, <utility>)
+SYMBOL(forward_as_tuple, std::, <tuple>)
+SYMBOL(forward_iterator_tag, std::, <iterator>)
+SYMBOL(forward_list, std::, <forward_list>)
+SYMBOL(fpclassify, std::, <cmath>)
+SYMBOL(fpos, std::, <ios>)
+SYMBOL(fprintf, std::, <cstdio>)
+SYMBOL(fputc, std::, <cstdio>)
+SYMBOL(fputs, std::, <cstdio>)
+SYMBOL(fputwc, std::, <cwchar>)
+SYMBOL(fputws, std::, <cwchar>)
+SYMBOL(fread, std::, <cstdio>)
+SYMBOL(free, std::, <cstdlib>)
+SYMBOL(freopen, std::, <cstdio>)
+SYMBOL(frexp, std::, <cmath>)
+SYMBOL(front_inserter, std::, <iterator>)
+SYMBOL(front_insert_iterator, std::, <iterator>)
+SYMBOL(from_chars, std::, <charconv>)
+SYMBOL(fscanf, std::, <cstdio>)
+SYMBOL(fseek, std::, <cstdio>)
+SYMBOL(fsetpos, std::, <cstdio>)
+SYMBOL(ftell, std::, <cstdio>)
+SYMBOL(function, std::, <functional>)
+SYMBOL(future, std::, <future>)
+SYMBOL(future_category, std::, <future>)
+SYMBOL(future_errc, std::, <future>)
+SYMBOL(future_error, std::, <future>)
+SYMBOL(future_status, std::, <future>)
+SYMBOL(fwide, std::, <cwchar>)
+SYMBOL(fwprintf, std::, <cwchar>)
+SYMBOL(fwrite, std::, <cstdio>)
+SYMBOL(fwscanf, std::, <cwchar>)
+SYMBOL(gamma_distribution, std::, <random>)
+SYMBOL(gcd, std::, <numeric>)
+SYMBOL(generate, std::, <algorithm>)
+SYMBOL(generate_canonical, std::, <random>)
+SYMBOL(generate_n, std::, <algorithm>)
+SYMBOL(generic_category, std::, <system_error>)
+SYMBOL(geometric_distribution, std::, <random>)
+SYMBOL(get_if, std::, <variant>)
+SYMBOL(get_money, std::, <iomanip>)
+SYMBOL(get_new_handler, std::, <new>)
+SYMBOL(get_pointer_safety, std::, <memory>)
+SYMBOL(get_terminate, std::, <exception>)
+SYMBOL(get_time, std::, <iomanip>)
+SYMBOL(getc, std::, <cstdio>)
+SYMBOL(getchar, std::, <cstdio>)
+SYMBOL(getenv, std::, <cstdlib>)
+SYMBOL(gets, std::, <cstdio>)
+SYMBOL(getwc, std::, <cwchar>)
+SYMBOL(getwchar, std::, <cwchar>)
+SYMBOL(gmtime, std::, <ctime>)
+SYMBOL(greater, std::, <functional>)
+SYMBOL(greater_equal, std::, <functional>)
+SYMBOL(gslice, std::, <valarray>)
+SYMBOL(gslice_array, std::, <valarray>)
+SYMBOL(hardware_constructive_interference_size, std::, <new>)
+SYMBOL(hardware_destructive_interference_size, std::, <new>)
+SYMBOL(has_facet, std::, <locale>)
+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(hex, std::, <ios>)
+SYMBOL(hexfloat, std::, <ios>)
+SYMBOL(holds_alternative, std::, <variant>)
+SYMBOL(hypot, std::, <cmath>)
+SYMBOL(ignore, std::, <tuple>)
+SYMBOL(ilogb, std::, <cmath>)
+SYMBOL(imag, std::, <complex>)
+SYMBOL(includes, std::, <algorithm>)
+SYMBOL(inclusive_scan, std::, <numeric>)
+SYMBOL(independent_bits_engine, std::, <random>)
+SYMBOL(indirect_array, std::, <valarray>)
+SYMBOL(inner_product, std::, <numeric>)
+SYMBOL(in_place, std::, <utility>)
+SYMBOL(in_place_index, std::, <utility>)
+SYMBOL(in_place_index_t, std::, <utility>)
+SYMBOL(in_place_t, std::, <utility>)
+SYMBOL(inplace_merge, std::, <algorithm>)
+SYMBOL(in_place_type, std::, <utility>)
+SYMBOL(in_place_type_t, std::, <utility>)
+SYMBOL(input_iterator_tag, std::, <iterator>)
+SYMBOL(inserter, std::, <iterator>)
+SYMBOL(insert_iterator, std::, <iterator>)
+SYMBOL(integer_sequence, std::, <utility>)
+SYMBOL(internal, std::, <ios>)
+SYMBOL(invalid_argument, std::, <stdexcept>)
+SYMBOL(invoke, std::, <functional>)
+SYMBOL(invoke_result, std::, <type_traits>)
+SYMBOL(invoke_result_t, std::, <type_traits>)
+SYMBOL(ios, std::, <ios>)
+SYMBOL(io_errc, std::, <ios>)
+SYMBOL(ios_base, std::, <ios>)
+SYMBOL(iostream_category, std::, <ios>)
+SYMBOL(iota, std::, <numeric>)
+SYMBOL(is_abstract, std::, <type_traits>)
+SYMBOL(is_abstract_v, std::, <type_traits>)
+SYMBOL(is_aggregate, std::, <type_traits>)
+SYMBOL(is_aggregate_v, std::, <type_traits>)
+SYMBOL(is_arithmetic, std::, <type_traits>)
+SYMBOL(is_arithmetic_v, std::, <type_traits>)
+SYMBOL(is_array, std::, <type_traits>)
+SYMBOL(is_array_v, std::, <type_traits>)
+SYMBOL(is_assignable, std::, <type_traits>)
+SYMBOL(is_assignable_v, std::, <type_traits>)
+SYMBOL(is_base_of, std::, <type_traits>)
+SYMBOL(is_base_of_v, std::, <type_traits>)
+SYMBOL(is_bind_expression, std::, <functional>)
+SYMBOL(is_bind_expression_v, std::, <functional>)
+SYMBOL(is_class, std::, <type_traits>)
+SYMBOL(is_class_v, std::, <type_traits>)
+SYMBOL(is_compound, std::, <type_traits>)
+SYMBOL(is_compound_v, std::, <type_traits>)
+SYMBOL(is_const, std::, <type_traits>)
+SYMBOL(is_constructible, std::, <type_traits>)
+SYMBOL(is_constructible_v, std::, <type_traits>)
+SYMBOL(is_const_v, std::, <type_traits>)
+SYMBOL(is_convertible, std::, <type_traits>)
+SYMBOL(is_convertible_v, std::, <type_traits>)
+SYMBOL(is_copy_assignable, std::, <type_traits>)
+SYMBOL(is_copy_assignable_v, std::, <type_traits>)
+SYMBOL(is_copy_constructible, std::, <type_traits>)
+SYMBOL(is_copy_constructible_v, std::, <type_traits>)
+SYMBOL(is_default_constructible, std::, <type_traits>)
+SYMBOL(is_default_constructible_v, std::, <type_traits>)
+SYMBOL(is_destructible, std::, <type_traits>)
+SYMBOL(is_destructible_v, std::, <type_traits>)
+SYMBOL(is_empty, std::, <type_traits>)
+SYMBOL(is_empty_v, std::, <type_traits>)
+SYMBOL(is_enum, std::, <type_traits>)
+SYMBOL(is_enum_v, std::, <type_traits>)
+SYMBOL(is_error_code_enum, std::, <system_error>)
+SYMBOL(is_error_condition_enum, std::, <system_error>)
+SYMBOL(is_error_condition_enum_v, std::, <system_error>)
+SYMBOL(is_final, std::, <type_traits>)
+SYMBOL(is_final_v, std::, <type_traits>)
+SYMBOL(is_floating_point, std::, <type_traits>)
+SYMBOL(is_floating_point_v, std::, <type_traits>)
+SYMBOL(is_function, std::, <type_traits>)
+SYMBOL(is_function_v, std::, <type_traits>)
+SYMBOL(is_fundamental, std::, <type_traits>)
+SYMBOL(is_fundamental_v, std::, <type_traits>)
+SYMBOL(is_heap, std::, <algorithm>)
+SYMBOL(is_heap_until, std::, <algorithm>)
+SYMBOL(is_integral, std::, <type_traits>)
+SYMBOL(is_integral_v, std::, <type_traits>)
+SYMBOL(is_lvalue_reference, std::, <type_traits>)
+SYMBOL(is_lvalue_reference_v, std::, <type_traits>)
+SYMBOL(is_member_function_pointer, std::, <type_traits>)
+SYMBOL(is_member_function_pointer_v, std::, <type_traits>)
+SYMBOL(is_member_object_pointer, std::, <type_traits>)
+SYMBOL(is_member_object_pointer_v, std::, <type_traits>)
+SYMBOL(is_member_pointer, std::, <type_traits>)
+SYMBOL(is_member_pointer_v, std::, <type_traits>)
+SYMBOL(is_move_assignable, std::, <type_traits>)
+SYMBOL(is_move_assignable_v, std::, <type_traits>)
+SYMBOL(is_move_constructible, std::, <type_traits>)
+SYMBOL(is_move_constructible_v, std::, <type_traits>)
+SYMBOL(is_nothrow_assignable, std::, <type_traits>)
+SYMBOL(is_nothrow_assignable_v, std::, <type_traits>)
+SYMBOL(is_nothrow_constructible, std::, <type_traits>)
+SYMBOL(is_nothrow_constructible_v, std::, <type_traits>)
+SYMBOL(is_nothrow_copy_assignable, std::, <type_traits>)
+SYMBOL(is_nothrow_copy_assignable_v, std::, <type_traits>)
+SYMBOL(is_nothrow_copy_constructible, std::, <type_traits>)
+SYMBOL(is_nothrow_copy_constructible_v, std::, <type_traits>)
+SYMBOL(is_nothrow_default_constructible, std::, <type_traits>)
+SYMBOL(is_nothrow_default_constructible_v, std::, <type_traits>)
+SYMBOL(is_nothrow_destructible, std::, <type_traits>)
+SYMBOL(is_nothrow_destructible_v, std::, <type_traits>)
+SYMBOL(is_nothrow_move_assignable, std::, <type_traits>)
+SYMBOL(is_nothrow_move_assignable_v, std::, <type_traits>)
+SYMBOL(is_nothrow_move_constructible, std::, <type_traits>)
+SYMBOL(is_nothrow_move_constructible_v, std::, <type_traits>)
+SYMBOL(is_nothrow_swappable, std::, <type_traits>)
+SYMBOL(is_nothrow_swappable_v, std::, <type_traits>)
+SYMBOL(is_nothrow_swappable_with, std::, <type_traits>)
+SYMBOL(is_nothrow_swappable_with_v, std::, <type_traits>)
+SYMBOL(is_null_pointer, std::, <type_traits>)
+SYMBOL(is_null_pointer_v, std::, <type_traits>)
+SYMBOL(is_object, std::, <type_traits>)
+SYMBOL(is_object_v, std::, <type_traits>)
+SYMBOL(is_partitioned, std::, <algorithm>)
+SYMBOL(is_permutation, std::, <algorithm>)
+SYMBOL(is_placeholder, std::, <functional>)
+SYMBOL(is_placeholder_v, std::, <functional>)
+SYMBOL(is_pod, std::, <type_traits>)
+SYMBOL(is_pod_v, std::, <type_traits>)
+SYMBOL(is_pointer, std::, <type_traits>)
+SYMBOL(is_pointer_v, std::, <type_traits>)
+SYMBOL(is_polymorphic, std::, <type_traits>)
+SYMBOL(is_polymorphic_v, std::, <type_traits>)
+SYMBOL(is_reference, std::, <type_traits>)
+SYMBOL(is_reference_v, std::, <type_traits>)
+SYMBOL(is_rvalue_reference, std::, <type_traits>)
+SYMBOL(is_rvalue_reference_v, std::, <type_traits>)
+SYMBOL(is_same, std::, <type_traits>)
+SYMBOL(is_same_v, std::, <type_traits>)
+SYMBOL(is_scalar, std::, <type_traits>)
+SYMBOL(is_scalar_v, std::, <type_traits>)
+SYMBOL(is_signed, std::, <type_traits>)
+SYMBOL(is_signed_v, std::, <type_traits>)
+SYMBOL(is_sorted, std::, <algorithm>)
+SYMBOL(is_sorted_until, std::, <algorithm>)
+SYMBOL(is_standard_layout, std::, <type_traits>)
+SYMBOL(is_standard_layout_v, std::, <type_traits>)
+SYMBOL(is_swappable, std::, <type_traits>)
+SYMBOL(is_swappable_v, std::, <type_traits>)
+SYMBOL(is_swappable_with, std::, <type_traits>)
+SYMBOL(is_swappable_with_v, std::, <type_traits>)
+SYMBOL(is_trivial, std::, <type_traits>)
+SYMBOL(is_trivially_assignable, std::, <type_traits>)
+SYMBOL(is_trivially_assignable_v, std::, <type_traits>)
+SYMBOL(is_trivially_constructible, std::, <type_traits>)
+SYMBOL(is_trivially_constructible_v, std::, <type_traits>)
+SYMBOL(is_trivially_copyable, std::, <type_traits>)
+SYMBOL(is_trivially_copyable_v, std::, <type_traits>)
+SYMBOL(is_trivially_copy_assignable, std::, <type_traits>)
+SYMBOL(is_trivially_copy_assignable_v, std::, <type_traits>)
+SYMBOL(is_trivially_copy_constructible, std::, <type_traits>)
+SYMBOL(is_trivially_copy_constructible_v, std::, <type_traits>)
+SYMBOL(is_trivially_default_constructible, std::, <type_traits>)
+SYMBOL(is_trivially_default_constructible_v, std::, <type_traits>)
+SYMBOL(is_trivially_destructible, std::, <type_traits>)
+SYMBOL(is_trivially_destructible_v, std::, <type_traits>)
+SYMBOL(is_trivially_move_assignable, std::, <type_traits>)
+SYMBOL(is_trivially_move_assignable_v, std::, <type_traits>)
+SYMBOL(is_trivially_move_constructible, std::, <type_traits>)
+SYMBOL(is_trivially_move_constructible_v, std::, <type_traits>)
+SYMBOL(is_trivial_v, std::, <type_traits>)
+SYMBOL(is_union, std::, <type_traits>)
+SYMBOL(is_union_v, std::, <type_traits>)
+SYMBOL(is_unsigned, std::, <type_traits>)
+SYMBOL(is_unsigned_v, std::, <type_traits>)
+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(isfinite, std::, <cmath>)
+SYMBOL(isgreater, std::, <cmath>)
+SYMBOL(isgreaterequal, std::, <cmath>)
+SYMBOL(isinf, std::, <cmath>)
+SYMBOL(isless, std::, <cmath>)
+SYMBOL(islessequal, std::, <cmath>)
+SYMBOL(islessgreater, std::, <cmath>)
+SYMBOL(isnan, std::, <cmath>)
+SYMBOL(isnormal, std::, <cmath>)
+SYMBOL(istreambuf_iterator, std::, <iterator>)
+SYMBOL(istream_iterator, std::, <iterator>)
+SYMBOL(isunordered, std::, <cmath>)
+SYMBOL(iswalnum, std::, <cwctype>)
+SYMBOL(iswalpha, std::, <cwctype>)
+SYMBOL(iswblank, std::, <cwctype>)
+SYMBOL(iswcntrl, std::, <cwctype>)
+SYMBOL(iswctype, std::, <cwctype>)
+SYMBOL(iswdigit, std::, <cwctype>)
+SYMBOL(iswgraph, std::, <cwctype>)
+SYMBOL(iswlower, std::, <cwctype>)
+SYMBOL(iswprint, std::, <cwctype>)
+SYMBOL(iswpunct, std::, <cwctype>)
+SYMBOL(iswspace, std::, <cwctype>)
+SYMBOL(iswupper, std::, <cwctype>)
+SYMBOL(iswxdigit, std::, <cwctype>)
+SYMBOL(iterator, std::, <iterator>)
+SYMBOL(iterator_traits, std::, <iterator>)
+SYMBOL(iter_swap, std::, <algorithm>)
+SYMBOL(jmp_buf, std::, <csetjmp>)
+SYMBOL(kill_dependency, std::, <atomic>)
+SYMBOL(launch, std::, <future>)
+SYMBOL(launder, std::, <new>)
+SYMBOL(lcm, std::, <numeric>)
+SYMBOL(lconv, std::, <clocale>)
+SYMBOL(ldexp, std::, <cmath>)
+SYMBOL(left, std::, <ios>)
+SYMBOL(length_error, std::, <stdexcept>)
+SYMBOL(less, std::, <functional>)
+SYMBOL(less_equal, std::, <functional>)
+SYMBOL(lexicographical_compare, std::, <algorithm>)
+SYMBOL(lgamma, std::, <cmath>)
+SYMBOL(list, std::, <list>)
+SYMBOL(llrint, std::, <cmath>)
+SYMBOL(llround, std::, <cmath>)
+SYMBOL(locale, std::, <locale>)
+SYMBOL(localeconv, std::, <clocale>)
+SYMBOL(localtime, std::, <ctime>)
+SYMBOL(lock, std::, <mutex>)
+SYMBOL(lock_guard, std::, <mutex>)
+SYMBOL(logb, std::, <cmath>)
+SYMBOL(log1p, std::, <cmath>)
+SYMBOL(log2, std::, <cmath>)
+SYMBOL(logical_and, std::, <functional>)
+SYMBOL(logic_error, std::, <stdexcept>)
+SYMBOL(lognormal_distribution, std::, <random>)
+SYMBOL(logical_not, std::, <functional>)
+SYMBOL(logical_or, std::, <functional>)
+SYMBOL(longjmp, std::, <csetjmp>)
+SYMBOL(lower_bound, std::, <algorithm>)
+SYMBOL(lrint, std::, <cmath>)
+SYMBOL(lround, std::, <cmath>)
+SYMBOL(make_exception_ptr, std::, <exception>)
+SYMBOL(make_from_tuple, std::, <tuple>)
+SYMBOL(make_heap, std::, <algorithm>)
+SYMBOL(make_move_iterator, std::, <iterator>)
+SYMBOL(make_optional, std::, <optional>)
+SYMBOL(make_pair, std::, <utility>)
+SYMBOL(make_reverse_iterator, std::, <iterator>)
+SYMBOL(make_shared, std::, <memory>)
+SYMBOL(make_signed, std::, <type_traits>)
+SYMBOL(make_signed_t, std::, <type_traits>)
+SYMBOL(make_tuple, std::, <tuple>)
+SYMBOL(make_unique, std::, <memory>)
+SYMBOL(make_unsigned, std::, <type_traits>)
+SYMBOL(make_unsigned_t, std::, <type_traits>)
+SYMBOL(malloc, std::, <cstdlib>)
+SYMBOL(map, std::, <map>)
+SYMBOL(mask_array, std::, <valarray>)
+SYMBOL(max, std::, <algorithm>)
+SYMBOL(max_align_t, std::, <cstddef>)
+SYMBOL(max_element, std::, <algorithm>)
+SYMBOL(mblen, std::, <cstdlib>)
+SYMBOL(mbrlen, std::, <cwchar>)
+SYMBOL(mbrtoc16, std::, <cuchar>)
+SYMBOL(mbrtoc32, std::, <cuchar>)
+SYMBOL(mbrtowc, std::, <cwchar>)
+SYMBOL(mbsinit, std::, <cwchar>)
+SYMBOL(mbsrtowcs, std::, <cwchar>)
+SYMBOL(mbstowcs, std::, <cstdlib>)
+SYMBOL(mbtowc, std::, <cstdlib>)
+SYMBOL(mem_fn, std::, <functional>)
+SYMBOL(memchr, std::, <cstring>)
+SYMBOL(memcmp, std::, <cstring>)
+SYMBOL(memcpy, std::, <cstring>)
+SYMBOL(memmove, std::, <cstring>)
+SYMBOL(memset, std::, <cstring>)
+SYMBOL(merge, std::, <algorithm>)
+SYMBOL(messages_base, std::, <locale>)
+SYMBOL(min, std::, <algorithm>)
+SYMBOL(min_element, std::, <algorithm>)
+SYMBOL(minmax, std::, <algorithm>)
+SYMBOL(minmax_element, std::, <algorithm>)
+SYMBOL(minus, std::, <functional>)
+SYMBOL(mismatch, std::, <algorithm>)
+SYMBOL(mktime, std::, <ctime>)
+SYMBOL(modf, std::, <cmath>)
+SYMBOL(modulus, std::, <functional>)
+SYMBOL(money_base, std::, <locale>)
+SYMBOL(monostate, std::, <variant>)
+SYMBOL(move_backward, std::, <algorithm>)
+SYMBOL(move_if_noexcept, std::, <utility>)
+SYMBOL(move_iterator, std::, <iterator>)
+SYMBOL(multimap, std::, <map>)
+SYMBOL(multiplies, std::, <functional>)
+SYMBOL(multiset, std::, <set>)
+SYMBOL(mutex, std::, <mutex>)
+SYMBOL(nan, std::, <cmath>)
+SYMBOL(nanf, std::, <cmath>)
+SYMBOL(nanl, std::, <cmath>)
+SYMBOL(nearbyint, std::, <cmath>)
+SYMBOL(negate, std::, <functional>)
+SYMBOL(negation, std::, <type_traits>)
+SYMBOL(negation_v, std::, <type_traits>)
+SYMBOL(negative_binomial_distribution, std::, <random>)
+SYMBOL(nested_exception, std::, <exception>)
+SYMBOL(new_handler, std::, <new>)
+SYMBOL(next, std::, <iterator>)
+SYMBOL(nextafter, std::, <cmath>)
+SYMBOL(next_permutation, std::, <algorithm>)
+SYMBOL(nexttoward, std::, <cmath>)
+SYMBOL(noboolalpha, std::, <ios>)
+SYMBOL(none_of, std::, <algorithm>)
+SYMBOL(norm, std::, <complex>)
+SYMBOL(normal_distribution, std::, <random>)
+SYMBOL(noshowbase, std::, <ios>)
+SYMBOL(noshowpoint, std::, <ios>)
+SYMBOL(noshowpos, std::, <ios>)
+SYMBOL(noskipws, std::, <ios>)
+SYMBOL(not_equal_to, std::, <functional>)
+SYMBOL(not_fn, std::, <functional>)
+SYMBOL(nothrow, std::, <new>)
+SYMBOL(nothrow_t, std::, <new>)
+SYMBOL(notify_all_at_thread_exit, std::, <condition_variable>)
+SYMBOL(nounitbuf, std::, <ios>)
+SYMBOL(nouppercase, std::, <ios>)
+SYMBOL(nth_element, std::, <algorithm>)
+SYMBOL(nullopt, std::, <optional>)
+SYMBOL(nullopt_t, std::, <optional>)
+SYMBOL(nullptr_t, std::, <cstddef>)
+SYMBOL(oct, std::, <ios>)
+SYMBOL(once_flag, std::, <mutex>)
+SYMBOL(optional, std::, <optional>)
+SYMBOL(ostreambuf_iterator, std::, <iterator>)
+SYMBOL(ostream_iterator, std::, <iterator>)
+SYMBOL(out_of_range, std::, <stdexcept>)
+SYMBOL(output_iterator_tag, std::, <iterator>)
+SYMBOL(overflow_error, std::, <stdexcept>)
+SYMBOL(owner_less, std::, <memory>)
+SYMBOL(packaged_task, std::, <future>)
+SYMBOL(pair, std::, <utility>)
+SYMBOL(partial_sort, std::, <algorithm>)
+SYMBOL(partial_sort_copy, std::, <algorithm>)
+SYMBOL(partial_sum, std::, <numeric>)
+SYMBOL(partition, std::, <algorithm>)
+SYMBOL(partition_copy, std::, <algorithm>)
+SYMBOL(partition_point, std::, <algorithm>)
+SYMBOL(perror, std::, <cstdio>)
+SYMBOL(piecewise_constant_distribution, std::, <random>)
+SYMBOL(piecewise_construct_t, std::, <utility>)
+SYMBOL(piecewise_linear_distribution, std::, <random>)
+SYMBOL(plus, std::, <functional>)
+SYMBOL(pointer_safety, std::, <memory>)
+SYMBOL(pointer_traits, std::, <memory>)
+SYMBOL(poisson_distribution, std::, <random>)
+SYMBOL(polymorphic_allocator, std::, <memory_resource>)
+SYMBOL(polar, std::, <complex>)
+SYMBOL(pop_heap, std::, <algorithm>)
+SYMBOL(prev, std::, <iterator>)
+SYMBOL(prev_permutation, std::, <algorithm>)
+SYMBOL(printf, std::, <cstdio>)
+SYMBOL(priority_queue, std::, <queue>)
+SYMBOL(proj, std::, <complex>)
+SYMBOL(promise, std::, <future>)
+SYMBOL(ptrdiff_t, std::, <cstddef>)
+SYMBOL(push_heap, std::, <algorithm>)
+SYMBOL(put_money, std::, <iomanip>)
+SYMBOL(put_time, std::, <iomanip>)
+SYMBOL(putc, std::, <cstdio>)
+SYMBOL(putchar, std::, <cstdio>)
+SYMBOL(puts, std::, <cstdio>)
+SYMBOL(putwc, std::, <cwchar>)
+SYMBOL(putwchar, std::, <cwchar>)
+SYMBOL(qsort, std::, <cstdlib>)
+SYMBOL(queue, std::, <queue>)
+SYMBOL(quick_exit, std::, <cstdlib>)
+SYMBOL(quoted, std::, <iomanip>)
+SYMBOL(raise, std::, <csignal>)
+SYMBOL(rand, std::, <cstdlib>)
+SYMBOL(random_access_iterator_tag, std::, <iterator>)
+SYMBOL(random_device, std::, <random>)
+SYMBOL(random_shuffle, std::, <algorithm>)
+SYMBOL(range_error, std::, <stdexcept>)
+SYMBOL(rank, std::, <type_traits>)
+SYMBOL(rank_v, std::, <type_traits>)
+SYMBOL(ratio_add, std::, <ratio>)
+SYMBOL(ratio_divide, std::, <ratio>)
+SYMBOL(ratio_equal, std::, <ratio>)
+SYMBOL(ratio_equal_v, std::, <ratio>)
+SYMBOL(ratio_greater, std::, <ratio>)
+SYMBOL(ratio_greater_equal, std::, <ratio>)
+SYMBOL(ratio_greater_equal_v, std::, <ratio>)
+SYMBOL(ratio_greater_v, std::, <ratio>)
+SYMBOL(ratio_less, std::, <ratio>)
+SYMBOL(ratio_less_equal, std::, <ratio>)
+SYMBOL(ratio_less_equal_v, std::, <ratio>)
+SYMBOL(ratio_less_v, std::, <ratio>)
+SYMBOL(ratio_multiply, std::, <ratio>)
+SYMBOL(ratio_not_equal, std::, <ratio>)
+SYMBOL(ratio_not_equal_v, std::, <ratio>)
+SYMBOL(ratio_subtract, std::, <ratio>)
+SYMBOL(rbegin, std::, <iterator>)
+SYMBOL(real, std::, <complex>)
+SYMBOL(realloc, std::, <cstdlib>)
+SYMBOL(recursive_mutex, std::, <mutex>)
+SYMBOL(recursive_timed_mutex, std::, <mutex>)
+SYMBOL(reduce, std::, <numeric>)
+SYMBOL(ref, std::, <functional>)
+SYMBOL(reference_wrapper, std::, <functional>)
+SYMBOL(regex_error, std::, <regex>)
+SYMBOL(regex_iterator, std::, <regex>)
+SYMBOL(regex_match, std::, <regex>)
+SYMBOL(regex_replace, std::, <regex>)
+SYMBOL(regex_search, std::, <regex>)
+SYMBOL(regex_traits, std::, <regex>)
+SYMBOL(reinterpret_pointer_cast, std::, <memory>)
+SYMBOL(remainder, std::, <cmath>)
+SYMBOL(remove_all_extents, std::, <type_traits>)
+SYMBOL(remove_all_extents_t, std::, <type_traits>)
+SYMBOL(remove_const, std::, <type_traits>)
+SYMBOL(remove_const_t, std::, <type_traits>)
+SYMBOL(remove_copy, std::, <algorithm>)
+SYMBOL(remove_copy_if, std::, <algorithm>)
+SYMBOL(remove_cv, std::, <type_traits>)
+SYMBOL(remove_cv_t, std::, <type_traits>)
+SYMBOL(remove_extent, std::, <type_traits>)
+SYMBOL(remove_extent_t, std::, <type_traits>)
+SYMBOL(remove_pointer, std::, <type_traits>)
+SYMBOL(remove_pointer_t, std::, <type_traits>)
+SYMBOL(remove_reference, std::, <type_traits>)
+SYMBOL(remove_reference_t, std::, <type_traits>)
+SYMBOL(remove_volatile, std::, <type_traits>)
+SYMBOL(remove_volatile_t, std::, <type_traits>)
+SYMBOL(remquo, std::, <cmath>)
+SYMBOL(rend, std::, <iterator>)
+SYMBOL(rename, std::, <cstdio>)
+SYMBOL(replace, std::, <algorithm>)
+SYMBOL(replace_copy, std::, <algorithm>)
+SYMBOL(replace_copy_if, std::, <algorithm>)
+SYMBOL(replace_if, std::, <algorithm>)
+SYMBOL(resetiosflags, std::, <iomanip>)
+SYMBOL(result_of, std::, <type_traits>)
+SYMBOL(result_of_t, std::, <type_traits>)
+SYMBOL(rethrow_exception, std::, <exception>)
+SYMBOL(rethrow_if_nested, std::, <exception>)
+SYMBOL(reverse, std::, <algorithm>)
+SYMBOL(reverse_copy, std::, <algorithm>)
+SYMBOL(reverse_iterator, std::, <iterator>)
+SYMBOL(rewind, std::, <cstdio>)
+SYMBOL(right, std::, <ios>)
+SYMBOL(rint, std::, <cmath>)
+SYMBOL(rotate, std::, <algorithm>)
+SYMBOL(rotate_copy, std::, <algorithm>)
+SYMBOL(round, std::, <cmath>)
+SYMBOL(round_indeterminate, std::, <limits>)
+SYMBOL(round_to_nearest, std::, <limits>)
+SYMBOL(round_toward_infinity, std::, <limits>)
+SYMBOL(round_toward_neg_infinity, std::, <limits>)
+SYMBOL(round_toward_zero, std::, <limits>)
+SYMBOL(runtime_error, std::, <stdexcept>)
+SYMBOL(sample, std::, <algorithm>)
+SYMBOL(scalbln, std::, <cmath>)
+SYMBOL(scalbn, std::, <cmath>)
+SYMBOL(scanf, std::, <cstdio>)
+SYMBOL(scientific, std::, <ios>)
+SYMBOL(scoped_allocator_adaptor, std::, <scoped_allocator>)
+SYMBOL(search, std::, <algorithm>)
+SYMBOL(search_n, std::, <algorithm>)
+SYMBOL(seed_seq, std::, <random>)
+SYMBOL(set, std::, <set>)
+SYMBOL(set_difference, std::, <algorithm>)
+SYMBOL(set_intersection, std::, <algorithm>)
+SYMBOL(set_new_handler, std::, <new>)
+SYMBOL(set_symmetric_difference, std::, <algorithm>)
+SYMBOL(set_terminate, std::, <exception>)
+SYMBOL(set_union, std::, <algorithm>)
+SYMBOL(setbase, std::, <iomanip>)
+SYMBOL(setbuf, std::, <cstdio>)
+SYMBOL(setfill, std::, <iomanip>)
+SYMBOL(setiosflags, std::, <iomanip>)
+SYMBOL(setlocale, std::, <clocale>)
+SYMBOL(setprecision, std::, <iomanip>)
+SYMBOL(setvbuf, std::, <cstdio>)
+SYMBOL(setw, std::, <iomanip>)
+SYMBOL(shared_future, std::, <future>)
+SYMBOL(shared_lock, std::, <shared_mutex>)
+SYMBOL(shared_mutex, std::, <shared_mutex>)
+SYMBOL(shared_ptr, std::, <memory>)
+SYMBOL(shared_timed_mutex, std::, <shared_mutex>)
+SYMBOL(showbase, std::, <ios>)
+SYMBOL(showpoint, std::, <ios>)
+SYMBOL(showpos, std::, <ios>)
+SYMBOL(shuffle, std::, <algorithm>)
+SYMBOL(sig_atomic_t, std::, <csignal>)
+SYMBOL(signal, std::, <csignal>)
+SYMBOL(signbit, std::, <cmath>)
+SYMBOL(size, std::, <iterator>)
+SYMBOL(skipws, std::, <ios>)
+SYMBOL(slice, std::, <valarray>)
+SYMBOL(slice_array, std::, <valarray>)
+SYMBOL(snprintf, std::, <cstdio>)
+SYMBOL(sort, std::, <algorithm>)
+SYMBOL(sort_heap, std::, <algorithm>)
+SYMBOL(sprintf, std::, <cstdio>)
+SYMBOL(srand, std::, <cstdlib>)
+SYMBOL(sregex_iterator, std::, <regex>)
+SYMBOL(sscanf, std::, <cstdio>)
+SYMBOL(stable_partition, std::, <algorithm>)
+SYMBOL(stable_sort, std::, <algorithm>)
+SYMBOL(stack, std::, <stack>)
+SYMBOL(static_pointer_cast, std::, <memory>)
+SYMBOL(strcat, std::, <cstring>)
+SYMBOL(strchr, std::, <cstring>)
+SYMBOL(strcmp, std::, <cstring>)
+SYMBOL(strcoll, std::, <cstring>)
+SYMBOL(strcpy, std::, <cstring>)
+SYMBOL(strcspn, std::, <cstring>)
+SYMBOL(streamoff, std::, <ios>)
+SYMBOL(streampos, std::, <ios>)
+SYMBOL(streamsize, std::, <ios>)
+SYMBOL(strerror, std::, <cstring>)
+SYMBOL(strftime, std::, <ctime>)
+SYMBOL(strlen, std::, <cstring>)
+SYMBOL(strncat, std::, <cstring>)
+SYMBOL(strncmp, std::, <cstring>)
+SYMBOL(strncpy, std::, <cstring>)
+SYMBOL(strpbrk, std::, <cstring>)
+SYMBOL(strrchr, std::, <cstring>)
+SYMBOL(strspn, std::, <cstring>)
+SYMBOL(strstr, std::, <cstring>)
+SYMBOL(strtod, std::, <cstdlib>)
+SYMBOL(strtof, std::, <cstdlib>)
+SYMBOL(strtoimax, std::, <cinttypes>)
+SYMBOL(strtok, std::, <cstring>)
+SYMBOL(strtol, std::, <cstdlib>)
+SYMBOL(strtold, std::, <cstdlib>)
+SYMBOL(strtoll, std::, <cstdlib>)
+SYMBOL(strtoul, std::, <cstdlib>)
+SYMBOL(strtoull, std::, <cstdlib>)
+SYMBOL(strtoumax, std::, <cinttypes>)
+SYMBOL(strxfrm, std::, <cstring>)
+SYMBOL(student_t_distribution, std::, <random>)
+SYMBOL(swap, std::, <algorithm><utility>)
+SYMBOL(swap_ranges, std::, <algorithm>)
+SYMBOL(swprintf, std::, <cwchar>)
+SYMBOL(swscanf, std::, <cwchar>)
+SYMBOL(system, std::, <cstdlib>)
+SYMBOL(system_category, std::, <system_error>)
+SYMBOL(system_error, std::, <system_error>)
+SYMBOL(terminate, std::, <exception>)
+SYMBOL(terminate_handler, std::, <exception>)
+SYMBOL(tgamma, std::, <cmath>)
+SYMBOL(thread, std::, <thread>)
+SYMBOL(throw_with_nested, std::, <exception>)
+SYMBOL(tie, std::, <tuple>)
+SYMBOL(time, std::, <ctime>)
+SYMBOL(time_base, std::, <locale>)
+SYMBOL(time_t, std::, <ctime>)
+SYMBOL(timed_mutex, std::, <mutex>)
+SYMBOL(timespec, std::, <ctime>)
+SYMBOL(timespec_get, std::, <ctime>)
+SYMBOL(tm, std::, <ctime>)
+SYMBOL(tmpfile, std::, <cstdio>)
+SYMBOL(tmpnam, std::, <cstdio>)
+SYMBOL(to_integer, std::, <cstddef>)
+SYMBOL(to_chars, std::, <charconv>)
+SYMBOL(to_string, std::, <string>)
+SYMBOL(towctrans, std::, <cwctype>)
+SYMBOL(towlower, std::, <cwctype>)
+SYMBOL(towupper, std::, <cwctype>)
+SYMBOL(transform, std::, <algorithm>)
+SYMBOL(transform_exclusive_scan, std::, <numeric>)
+SYMBOL(transform_inclusive_scan, std::, <numeric>)
+SYMBOL(transform_reduce, std::, <numeric>)
+SYMBOL(trunc, std::, <cmath>)
+SYMBOL(try_lock, std::, <mutex>)
+SYMBOL(try_to_lock, std::, <mutex>)
+SYMBOL(try_to_lock_t, std::, <mutex>)
+SYMBOL(tuple, std::, <tuple>)
+SYMBOL(tuple_cat, std::, <tuple>)
+SYMBOL(type_index, std::, <typeindex>)
+SYMBOL(type_info, std::, <typeinfo>)
+SYMBOL(u16streampos, std::, <ios>)
+SYMBOL(u32streampos, std::, <ios>)
+SYMBOL(uncaught_exceptions, std::, <exception>)
+SYMBOL(undeclare_no_pointers, std::, <memory>)
+SYMBOL(undeclare_reachable, std::, <memory>)
+SYMBOL(underflow_error, std::, <stdexcept>)
+SYMBOL(underlying_type, std::, <type_traits>)
+SYMBOL(underlying_type_t, std::, <type_traits>)
+SYMBOL(ungetc, std::, <cstdio>)
+SYMBOL(ungetwc, std::, <cwchar>)
+SYMBOL(uniform_int_distribution, std::, <random>)
+SYMBOL(uniform_real_distribution, std::, <random>)
+SYMBOL(uninitialized_copy, std::, <memory>)
+SYMBOL(uninitialized_copy_n, std::, <memory>)
+SYMBOL(uninitialized_default_construct, std::, <memory>)
+SYMBOL(uninitialized_default_construct_n, std::, <memory>)
+SYMBOL(uninitialized_fill, std::, <memory>)
+SYMBOL(uninitialized_fill_n, std::, <memory>)
+SYMBOL(uninitialized_move, std::, <memory>)
+SYMBOL(uninitialized_move_n, std::, <memory>)
+SYMBOL(uninitialized_value_construct, std::, <memory>)
+SYMBOL(uninitialized_value_construct_n, std::, <memory>)
+SYMBOL(unique, std::, <algorithm>)
+SYMBOL(unique_copy, std::, <algorithm>)
+SYMBOL(unique_lock, std::, <mutex>)
+SYMBOL(unique_ptr, std::, <memory>)
+SYMBOL(unitbuf, std::, <ios>)
+SYMBOL(unordered_map, std::, <unordered_map>)
+SYMBOL(unordered_multimap, std::, <unordered_map>)
+SYMBOL(unordered_multiset, std::, <unordered_set>)
+SYMBOL(unordered_set, std::, <unordered_set>)
+SYMBOL(upper_bound, std::, <algorithm>)
+SYMBOL(uppercase, std::, <ios>)
+SYMBOL(use_facet, std::, <locale>)
+SYMBOL(uses_allocator_v, std::, <memory>)
+SYMBOL(va_list, std::, <cstdarg>)
+SYMBOL(valarray, std::, <valarray>)
+SYMBOL(variant, std::, <variant>)
+SYMBOL(variant_alternative, std::, <variant>)
+SYMBOL(variant_alternative_t, std::, <variant>)
+SYMBOL(variant_npos, std::, <variant>)
+SYMBOL(variant_size, std::, <variant>)
+SYMBOL(variant_size_v, std::, <variant>)
+SYMBOL(vector, std::, <vector>)
+SYMBOL(vfprintf, std::, <cstdio>)
+SYMBOL(vfscanf, std::, <cstdio>)
+SYMBOL(vfwprintf, std::, <cwchar>)
+SYMBOL(vfwscanf, std::, <cwchar>)
+SYMBOL(visit, std::, <variant>)
+SYMBOL(void_t, std::, <type_traits>)
+SYMBOL(vprintf, std::, <cstdio>)
+SYMBOL(vscanf, std::, <cstdio>)
+SYMBOL(vsnprintf, std::, <cstdio>)
+SYMBOL(vsprintf, std::, <cstdio>)
+SYMBOL(vsscanf, std::, <cstdio>)
+SYMBOL(vswprintf, std::, <cwchar>)
+SYMBOL(vswscanf, std::, <cwchar>)
+SYMBOL(vwprintf, std::, <cwchar>)
+SYMBOL(vwscanf, std::, <cwchar>)
+SYMBOL(wbuffer_convert, std::, <locale>)
+SYMBOL(wcerr, std::, <iostream>)
+SYMBOL(wcin, std::, <iostream>)
+SYMBOL(wclog, std::, <iostream>)
+SYMBOL(wcout, std::, <iostream>)
+SYMBOL(wcregex_iterator, std::, <regex>)
+SYMBOL(wcrtomb, std::, <cwchar>)
+SYMBOL(wcscat, std::, <cwchar>)
+SYMBOL(wcschr, std::, <cwchar>)
+SYMBOL(wcscmp, std::, <cwchar>)
+SYMBOL(wcscoll, std::, <cwchar>)
+SYMBOL(wcscpy, std::, <cwchar>)
+SYMBOL(wcscspn, std::, <cwchar>)
+SYMBOL(wcsftime, std::, <cwchar>)
+SYMBOL(wcslen, std::, <cwchar>)
+SYMBOL(wcsncat, std::, <cwchar>)
+SYMBOL(wcsncmp, std::, <cwchar>)
+SYMBOL(wcsncpy, std::, <cwchar>)
+SYMBOL(wcspbrk, std::, <cwchar>)
+SYMBOL(wcsrchr, std::, <cwchar>)
+SYMBOL(wcsrtombs, std::, <cwchar>)
+SYMBOL(wcsspn, std::, <cwchar>)
+SYMBOL(wcsstr, std::, <cwchar>)
+SYMBOL(wcstod, std::, <cwchar>)
+SYMBOL(wcstof, std::, <cwchar>)
+SYMBOL(wcstoimax, std::, <cinttypes>)
+SYMBOL(wcstok, std::, <cwchar>)
+SYMBOL(wcstol, std::, <cwchar>)
+SYMBOL(wcstold, std::, <cwchar>)
+SYMBOL(wcstoll, std::, <cwchar>)
+SYMBOL(wcstombs, std::, <cstdlib>)
+SYMBOL(wcstoul, std::, <cwchar>)
+SYMBOL(wcstoull, std::, <cwchar>)
+SYMBOL(wcstoumax, std::, <cinttypes>)
+SYMBOL(wcsxfrm, std::, <cwchar>)
+SYMBOL(wctob, std::, <cwchar>)
+SYMBOL(wctomb, std::, <cstdlib>)
+SYMBOL(wctrans, std::, <cwctype>)
+SYMBOL(wctype, std::, <cwctype>)
+SYMBOL(weak_ptr, std::, <memory>)
+SYMBOL(weibull_distribution, std::, <random>)
+SYMBOL(wios, std::, <ios>)
+SYMBOL(wmemchr, std::, <cwchar>)
+SYMBOL(wmemcmp, std::, <cwchar>)
+SYMBOL(wmemcpy, std::, <cwchar>)
+SYMBOL(wmemmove, std::, <cwchar>)
+SYMBOL(wmemset, std::, <cwchar>)
+SYMBOL(ws, std::, <istream>)
+SYMBOL(wstreampos, std::, <ios>)
+SYMBOL(wprintf, std::, <cwchar>)
+SYMBOL(wscanf, std::, <cwchar>)
+SYMBOL(wsregex_iterator, std::, <regex>)
+SYMBOL(wstring_convert, std::, <locale>)
Index: clangd/StdGen/spec/test.js
===================================================================
--- /dev/null
+++ clangd/StdGen/spec/test.js
@@ -0,0 +1,80 @@
+const assert = require("assert")
+const { retrieveDefinedHeaders, parseSymbolIndexPage } = require('../lib/parse')
+
+describe('generate std symbol', () => {
+  describe('parse symbol index page', () => {
+    it('should parse index page', () => {
+      // A fake symbol index page:
+      //   abs() (int)
+      //   abs<>() (std::complex)
+      //   acos()
+      //   acosh() (since C++11)
+      //   as_bytes() (since C++20)  <-- ignored
+      const symbolIndexPageHTML = `
+        <a href="abs.html" title="abs"><tt>abs()</tt></a> (int) <br>
+        <a href="complex/abs.html" title="abs"><tt>abs&lt;&gt;()</tt></a> (std::complex) <br>
+        <a href="acos.html" title="acos"><tt>acos()</tt></a> <br>
+        <a href="acosh.html" title="acosh"><tt>acosh()</tt></a> <span class="t-mark-rev">(since C++11)</span> <br>
+        <a href="as_bytes.html" title="as bytes"><tt>as_bytes&lt;&gt;()</tt></a> <span class="t-mark-rev t-since-cxx20">(since C++20)</span> <br>
+      `
+      const SymbolData = parseSymbolIndexPage(symbolIndexPageHTML)
+      assert.equal(4, SymbolData.length);
+      const expected = [
+        { name: 'abs', pagePath: 'abs.html' },
+        { name: 'abs', pagePath: 'complex/abs.html' },
+        { name: 'acos', pagePath: 'acos.html' },
+        { name: 'acosh', pagePath: 'acosh.html' }
+      ]
+      for (let i = 0; i < SymbolData.length; ++i) {
+        assert.equal(SymbolData[i].name, expected[i].name)
+        assert.ok(SymbolData[i].pagePath.endsWith(expected[i].pagePath))
+      }
+    });
+  })
+
+  describe('parse symbol page', () => {
+    it('should get single header', () => {
+      // Defined in header <cmath>
+      const symbolPageHTML = `
+        <table class="t-dcl-begin"><tbody>
+          <tr class="t-dsc-header">
+          <td> <div>Defined in header <code><a href="cmath.html" title="cmath">&lt;cmath&gt;</a></code>
+           </div></td>
+          <td></td>
+          <td></td>
+          </tr>
+        </tbody></table>`
+      const headers = retrieveDefinedHeaders(symbolPageHTML)
+      assert.deepEqual(headers, ['<cmath>'])
+    })
+    it('should get multiple headers', () => {
+      // Defined in header <cstddef>
+      // Defined in header <cstdio>
+      // Defined in header <cstdlib>
+      const symbolPageHTML = `
+        <table class="t-dcl-begin"><tbody>
+          <tr class="t-dsc-header">
+            <td> <div>Defined in header <code><a href="cstddef.html" title="cstddef">&lt;cstddef&gt;</a></code>
+             </div></td>
+             <td></td>
+            <td></td>
+          </tr>
+          <tr class="t-dsc-header">
+            <td> <div>Defined in header <code><a href="cstdio.html" title="cstdio">&lt;cstdio&gt;</a></code>
+             </div></td>
+            <td></td>
+            <td></td>
+          </tr>
+          <tr class="t-dsc-header">
+            <td> <div>Defined in header <code><a href=".cstdlib.html" title="ccstdlib">&lt;cstdlib&gt;</a></code>
+             </div></td>
+            <td></td>
+            <td></td>
+          </tr>
+        </tbody></table>
+      `
+      assert.deepEqual(retrieveDefinedHeaders(symbolPageHTML),
+                             ['<cstddef>', '<cstdio>', '<cstdlib>'])
+    })
+  })
+})
Index: clangd/StdGen/package.json
===================================================================
--- /dev/null
+++ clangd/StdGen/package.json
@@ -0,0 +1,20 @@
+{
+  "name": "StlGen",
+  "version": "0.0.1",
+  "description": "generate headers for C++ Standard Library symbols from cppreference",
+  "scripts": {
+    "gen": "node lib/main.js",
+    "test": "./node_modules/mocha/bin/mocha spec/*.js"
+  },
+  "keywords": [
+    "C++",
+    "cppreference",
+    "STL"
+  ],
+  "dependencies": {
+    "cheerio": "^1.0.0-rc.2"
+  },
+  "devDependencies": {
+    "mocha": "^6.0.0"
+  }
+}
Index: clangd/StdGen/lib/parse.js
===================================================================
--- /dev/null
+++ clangd/StdGen/lib/parse.js
@@ -0,0 +1,65 @@
+const $ = require('cheerio')
+const path = require('path')
+
+const { cppSymbolRoot } = require('./config')
+
+function retrieveDefinedHeaders(htmlContent) {
+  // In the symbol detailed page, we have canonical "Defined in header <...>"
+  // words, which is defined in <tr class="t-dsc-header">/<tr class="t-dcl-header">.
+  // so we try to retrieve the header from this HTML element.
+  const headerSelector = 'tr.t-dcl-header, tr.t-dsc-header:contains("Defined in header ")'
+  const headerTrElements = $.load(htmlContent)(headerSelector)
+  const headers = []
+  headerTrElements.each((_, element) => {
+    // The interesting header content (e.g. <cstdlib>) is wrapped in <code> tag.
+    headers.push($('code', element).text())
+  })
+  return headers
+}
+
+function retrieveSymbolData(ttElement) {
+  if (ttElement.name != 'tt') {
+    console.error('The input parameter should be <tt> element: ' + ttElement)
+    return null
+  }
+
+  const hrefElement = ttElement.parent
+  // Iterate following sibling elements to see whether there is
+  // a revision label like "since C++11" after the symbol name.
+  let revision = ""
+  $(hrefElement).nextUntil('br', (_, spanElement) => {
+    // An element contains the symbol revision.
+    if ($(spanElement).hasClass('t-mark-rev')) {
+      const matched = $(spanElement).text().match(/since (C\+\+[\d]{2})/)
+      if (matched) {
+        revision = matched[1]
+      }
+    }
+  })
+  // Skip C++20 symbols as C++20 is not finalized yet.
+  if (revision == 'C++20')
+    return null
+  return {
+    name: $(ttElement).text().match(/\w+/g)[0],
+    pagePath: path.join(cppSymbolRoot, hrefElement.attribs['href'])
+  }
+}
+
+// Parse the symbol index page. Returns an array of
+// {name: <unqualified_name>, pagePath: <path>}  objects.
+function parseSymbolIndexPage(htmlContent) {
+  let results = []
+  const allSymbolTtElements = $.load(htmlContent)('a[title] > tt').get()
+  for (let symbolTtElement of allSymbolTtElements) {
+    const symbolData = retrieveSymbolData(symbolTtElement)
+    if (!symbolData)
+      continue
+    results.push(symbolData)
+  }
+  return results
+}
+
+module.exports = {
+  parseSymbolIndexPage,
+  retrieveDefinedHeaders,
+}
Index: clangd/StdGen/lib/main.js
===================================================================
--- /dev/null
+++ clangd/StdGen/lib/main.js
@@ -0,0 +1,85 @@
+const $ = require('cheerio')
+const fs = require('fs')
+const path = require('path')
+
+const { cppSymbolRoot, cppSymbolIndexPath } = require('./config')
+const { retrieveDefinedHeaders, parseSymbolIndexPage } = require('./parse')
+
+class Symbol {
+  constructor(name, namespace, headers) {
+    this.name = name // unqualifed name, e.g. std::move
+    this.namespace = namespace // namespace, e.g. std::, std::pmr
+    this.headers = headers // array of headers
+  }
+}
+
+function readFile(path) {
+  return new Promise((resolve, reject) => {
+    fs.readFile(path, (err, data) => {
+      if (err) reject(err)
+      else resolve(data)
+    })
+  })
+}
+
+async function process() {
+  // Workflow steps:
+  //  1. Parse the index page which lists all symbols, and extract symbol
+  //     name (unqualified name) and its href link to the detailed page which
+  //     contains the defined header.
+  //  2. Parse the detailed page to get the defined header.
+  let indexPageHTML = await readFile(cppSymbolIndexPath)
+  const symbolData = parseSymbolIndexPage(indexPageHTML)
+  // A map from symbol name to its headers.
+  const Symbols = new Map()
+  for (let symbol of symbolData) {
+    const symbolName = symbol.name
+    const symbolPagePath = symbol.pagePath
+
+    const symbolPageHTML = await readFile(symbolPagePath)
+    const headers = retrieveDefinedHeaders(symbolPageHTML)
+    if (headers.length == 0) {
+      console.error(new Error('No header found for symbol: ' + symbolName + ` at ` + symbolPagePath))
+      continue
+    }
+    // FIXME: support ambiguous symbols.
+    if (headers.length != 1) {
+      continue
+    }
+
+    let symbolHeaders = Symbols.get(symbolName)
+    if (!symbolHeaders) {
+      symbolHeaders = new Set(headers)
+      Symbols.set(symbolName, symbolHeaders)
+    }
+    for (let header of headers)
+      symbolHeaders.add(header)
+  }
+  const Results = []
+  Symbols.forEach((headers, symbolName) => {
+    Results.push(new Symbol(symbolName, 'std::', Array.from(headers)))
+  })
+  emitResults(Results)
+}
+
+function emitResults(symbols) {
+  console.log(`//===-- StdGen'erated file --------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+// Used to build a map (qualified names => include headers) for all symbols from
+// C++ Standard Library (up to C++17).
+//
+// Automatically generated file, do not edit.
+//===----------------------------------------------------------------------===//
+`)
+  symbols.filter(symbol =>  symbol.headers.length == 1).forEach(sym => {
+    for (let header of sym.headers)
+      console.log(`SYMBOL(%s, %s, %s)`, sym.name, sym.namespace, header)
+  })
+}
+
+process()
Index: clangd/StdGen/lib/config.js
===================================================================
--- /dev/null
+++ clangd/StdGen/lib/config.js
@@ -0,0 +1,17 @@
+const fs = require('fs')
+const path = require('path')
+
+const srcDir = path.dirname(__dirname)
+const cppReferenceRoot = path.join(srcDir, 'reference');
+const cppSymbolRoot = path.join(cppReferenceRoot, 'en/cpp/')
+const cppSymbolIndexPath = path.join(cppSymbolRoot, 'symbol_index.html')
+
+if (!fs.existsSync(cppReferenceRoot)) {
+  console.error('Please download the cppreference offline copy.')
+  process.exit(1);
+}
+
+module.exports = {
+  cppSymbolIndexPath,
+  cppSymbolRoot,
+}
Index: clangd/StdGen/Readme.md
===================================================================
--- /dev/null
+++ clangd/StdGen/Readme.md
@@ -0,0 +1,18 @@
+# StdGen
+
+StdGen is a tool to generate headers for C++ Standard Library symbols by parsing
+archieved HTML files from [cppreference](http://cppreference.com/).
+
+## Usage
+
+### Requriement
+
+* Download the cppreference [offline HTML files](https://en.cppreference.com/w/Cppreference:Archives),
+and unzip it to the `<StdGen_dir>/reference` directory.
+
+### Step
+
+```shell
+$ npm install
+$ node lib/main.js > Symbols.inc
+```
Index: clangd/StdGen/.gitignore
===================================================================
--- /dev/null
+++ clangd/StdGen/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+reference
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to