Index: clangd/StdSymbolMap.inc =================================================================== --- clangd/StdSymbolMap.inc +++ clangd/StdSymbolMap.inc @@ -42,6 +42,8 @@ SYMBOL(UnsignedIntegral, std::, ) SYMBOL(_Exit, std::, ) SYMBOL(accumulate, std::, ) +SYMBOL(acos, std::, ) +SYMBOL(acosh, std::, ) SYMBOL(add_const, std::, ) SYMBOL(add_const_t, std::, ) SYMBOL(add_cv, std::, ) @@ -82,8 +84,13 @@ SYMBOL(array, std::, ) SYMBOL(as_const, std::, ) SYMBOL(asctime, std::, ) +SYMBOL(asin, std::, ) +SYMBOL(asinh, std::, ) SYMBOL(async, std::, ) SYMBOL(at_quick_exit, std::, ) +SYMBOL(atan, std::, ) +SYMBOL(atan2, std::, ) +SYMBOL(atanh, std::, ) SYMBOL(atexit, std::, ) SYMBOL(atof, std::, ) SYMBOL(atoi, std::, ) @@ -220,6 +227,8 @@ SYMBOL(copy_if, std::, ) SYMBOL(copy_n, std::, ) SYMBOL(copysign, std::, ) +SYMBOL(cos, std::, ) +SYMBOL(cosh, std::, ) SYMBOL(count, std::, ) SYMBOL(count_if, std::, ) SYMBOL(cout, std::, ) @@ -292,6 +301,7 @@ SYMBOL(exchange, std::, ) SYMBOL(exclusive_scan, std::, ) SYMBOL(exit, std::, ) +SYMBOL(exp, std::, ) SYMBOL(exp2, std::, ) SYMBOL(expm1, std::, ) SYMBOL(exponential_distribution, std::, ) @@ -609,20 +619,31 @@ SYMBOL(is_void_v, std::, ) SYMBOL(is_volatile, std::, ) SYMBOL(is_volatile_v, std::, ) +SYMBOL(isalnum, std::, ) +SYMBOL(isalpha, std::, ) +SYMBOL(isblank, std::, ) +SYMBOL(iscntrl, std::, ) +SYMBOL(isdigit, std::, ) SYMBOL(isfinite, std::, ) +SYMBOL(isgraph, std::, ) SYMBOL(isgreater, std::, ) SYMBOL(isgreaterequal, std::, ) SYMBOL(isinf, std::, ) SYMBOL(isless, std::, ) SYMBOL(islessequal, std::, ) SYMBOL(islessgreater, std::, ) +SYMBOL(islower, std::, ) SYMBOL(isnan, std::, ) SYMBOL(isnormal, std::, ) SYMBOL(ispow2, std::, ) +SYMBOL(isprint, std::, ) +SYMBOL(ispunct, std::, ) +SYMBOL(isspace, std::, ) SYMBOL(istream_iterator, std::, ) SYMBOL(istreambuf_iterator, std::, ) SYMBOL(istringstream, std::, ) SYMBOL(isunordered, std::, ) +SYMBOL(isupper, std::, ) SYMBOL(iswalnum, std::, ) SYMBOL(iswalpha, std::, ) SYMBOL(iswblank, std::, ) @@ -636,6 +657,7 @@ SYMBOL(iswspace, std::, ) SYMBOL(iswupper, std::, ) SYMBOL(iswxdigit, std::, ) +SYMBOL(isxdigit, std::, ) SYMBOL(iter_swap, std::, ) SYMBOL(iterator, std::, ) SYMBOL(iterator_traits, std::, ) @@ -663,6 +685,8 @@ SYMBOL(localtime, std::, ) SYMBOL(lock, std::, ) SYMBOL(lock_guard, std::, ) +SYMBOL(log, std::, ) +SYMBOL(log10, std::, ) SYMBOL(log1p, std::, ) SYMBOL(log2, std::, ) SYMBOL(log2p1, std::, ) @@ -824,6 +848,7 @@ SYMBOL(polar, std::, ) SYMBOL(polymorphic_allocator, std::, ) SYMBOL(pop_heap, std::, ) +SYMBOL(pow, std::, ) SYMBOL(prev, std::, ) SYMBOL(prev_permutation, std::, ) SYMBOL(printf, std::, ) @@ -886,6 +911,7 @@ SYMBOL(regex_traits, std::, ) SYMBOL(reinterpret_pointer_cast, std::, ) SYMBOL(remainder, std::, ) +SYMBOL(remove, std::, ) SYMBOL(remove_all_extents, std::, ) SYMBOL(remove_all_extents_t, std::, ) SYMBOL(remove_const, std::, ) @@ -970,6 +996,8 @@ SYMBOL(sig_atomic_t, std::, ) SYMBOL(signal, std::, ) SYMBOL(signbit, std::, ) +SYMBOL(sin, std::, ) +SYMBOL(sinh, std::, ) SYMBOL(size, std::, ) SYMBOL(skipws, std::, ) SYMBOL(slice, std::, ) @@ -980,6 +1008,7 @@ SYMBOL(sort_heap, std::, ) SYMBOL(span, std::, ) SYMBOL(sprintf, std::, ) +SYMBOL(sqrt, std::, ) SYMBOL(srand, std::, ) SYMBOL(sregex_iterator, std::, ) SYMBOL(sregex_token_iterator, std::, ) @@ -1038,6 +1067,8 @@ SYMBOL(system, std::, ) SYMBOL(system_category, std::, ) SYMBOL(system_error, std::, ) +SYMBOL(tan, std::, ) +SYMBOL(tanh, std::, ) SYMBOL(tera, std::, ) SYMBOL(terminate, std::, ) SYMBOL(terminate_handler, std::, ) @@ -1062,6 +1093,8 @@ SYMBOL(to_chars, std::, ) SYMBOL(to_integer, std::, ) SYMBOL(to_string, std::, ) +SYMBOL(tolower, std::, ) +SYMBOL(toupper, std::, ) SYMBOL(towctrans, std::, ) SYMBOL(towlower, std::, ) SYMBOL(towupper, std::, ) @@ -1118,6 +1151,7 @@ SYMBOL(upper_bound, std::, ) SYMBOL(uppercase, std::, ) SYMBOL(use_facet, std::, ) +SYMBOL(uses_allocator, std::, ) SYMBOL(uses_allocator_v, std::, ) SYMBOL(va_list, std::, ) SYMBOL(valarray, std::, ) Index: clangd/include-mapping/gen_std.py =================================================================== --- clangd/include-mapping/gen_std.py +++ clangd/include-mapping/gen_std.py @@ -28,7 +28,7 @@ gen_std.py -cppreference > StdSymbolMap.inc """ -from bs4 import BeautifulSoup +from bs4 import BeautifulSoup, NavigableString import argparse import collections @@ -82,15 +82,21 @@ abs() (int)
acos()
- Returns a list of tuple (symbol_name, relative_path_to_symbol_page). + Returns a list of tuple (symbol_name, relative_path_to_symbol_page, variant). """ symbols = [] soup = BeautifulSoup(index_page_html, "html.parser") for symbol_href in soup.select("a[title]"): + # Ignore annotated symbols like "acos<>() (std::complex)". + # These tend to be overloads, and we the primary is more useful. + # 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 = isinstance(caption, NavigableString) and "(" in caption symbol_tt = symbol_href.find("tt") if symbol_tt: symbols.append((symbol_tt.text.rstrip("<>()"), # strip any trailing <>() - symbol_href["href"])) + symbol_href["href"], variant)) return symbols class Symbol: @@ -125,7 +131,11 @@ with open(index_page_path, "r") as f: # Read each symbol page in parallel. results = [] # (symbol_name, promise of [header...]) - for symbol_name, symbol_page_path in ParseIndexPage(f.read()): + 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. + if variant: + continue path = os.path.join(root_dir, symbol_page_path) results.append((symbol_name, pool.apply_async(ReadSymbolPage, (path, symbol_name)))) Index: clangd/include-mapping/test.py =================================================================== --- clangd/include-mapping/test.py +++ clangd/include-mapping/test.py @@ -24,16 +24,17 @@ actual = ParseIndexPage(html) expected = [ - ("abs", "abs.html"), - ("abs", "complex/abs.html"), - ("acos", "acos.html"), - ("acosh", "acosh.html"), - ("as_bytes", "as_bytes.html"), + ("abs", "abs.html", True), + ("abs", "complex/abs.html", True), + ("acos", "acos.html", False), + ("acosh", "acosh.html", False), + ("as_bytes", "as_bytes.html", False), ] self.assertEqual(len(actual), len(expected)) for i in range(0, len(actual)): self.assertEqual(expected[i][0], actual[i][0]) self.assertTrue(actual[i][1].endswith(expected[i][1])) + self.assertEqual(expected[i][2], actual[i][2]) def testParseSymbolPage_SingleHeader(self):