sammccall updated this revision to Diff 197719. sammccall added a comment. Add note about skipping variants, and mention the weird begin/end case.
Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61349/new/ https://reviews.llvm.org/D61349 Files: clangd/StdSymbolMap.inc clangd/include-mapping/gen_std.py clangd/include-mapping/test.py
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): 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 </cppreference/reference> > StdSymbolMap.inc """ -from bs4 import BeautifulSoup +from bs4 import BeautifulSoup, NavigableString import argparse import collections @@ -82,15 +82,21 @@ <a href="abs.html" title="abs"><tt>abs()</tt></a> (int) <br> <a href="acos.html" title="acos"><tt>acos()</tt></a> <br> - 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/StdSymbolMap.inc =================================================================== --- clangd/StdSymbolMap.inc +++ clangd/StdSymbolMap.inc @@ -42,6 +42,8 @@ SYMBOL(UnsignedIntegral, std::, <concepts>) SYMBOL(_Exit, std::, <cstdlib>) SYMBOL(accumulate, std::, <numeric>) +SYMBOL(acos, std::, <cmath>) +SYMBOL(acosh, std::, <cmath>) SYMBOL(add_const, std::, <type_traits>) SYMBOL(add_const_t, std::, <type_traits>) SYMBOL(add_cv, std::, <type_traits>) @@ -82,8 +84,13 @@ SYMBOL(array, std::, <array>) SYMBOL(as_const, std::, <utility>) SYMBOL(asctime, std::, <ctime>) +SYMBOL(asin, std::, <cmath>) +SYMBOL(asinh, std::, <cmath>) SYMBOL(async, std::, <future>) SYMBOL(at_quick_exit, std::, <cstdlib>) +SYMBOL(atan, std::, <cmath>) +SYMBOL(atan2, std::, <cmath>) +SYMBOL(atanh, std::, <cmath>) SYMBOL(atexit, std::, <cstdlib>) SYMBOL(atof, std::, <cstdlib>) SYMBOL(atoi, std::, <cstdlib>) @@ -220,6 +227,8 @@ SYMBOL(copy_if, std::, <algorithm>) SYMBOL(copy_n, std::, <algorithm>) SYMBOL(copysign, std::, <cmath>) +SYMBOL(cos, std::, <cmath>) +SYMBOL(cosh, std::, <cmath>) SYMBOL(count, std::, <algorithm>) SYMBOL(count_if, std::, <algorithm>) SYMBOL(cout, std::, <iostream>) @@ -292,6 +301,7 @@ SYMBOL(exchange, std::, <utility>) SYMBOL(exclusive_scan, std::, <numeric>) SYMBOL(exit, std::, <cstdlib>) +SYMBOL(exp, std::, <cmath>) SYMBOL(exp2, std::, <cmath>) SYMBOL(expm1, std::, <cmath>) SYMBOL(exponential_distribution, std::, <random>) @@ -609,20 +619,31 @@ SYMBOL(is_void_v, std::, <type_traits>) SYMBOL(is_volatile, std::, <type_traits>) SYMBOL(is_volatile_v, std::, <type_traits>) +SYMBOL(isalnum, std::, <cctype>) +SYMBOL(isalpha, std::, <cctype>) +SYMBOL(isblank, std::, <cctype>) +SYMBOL(iscntrl, std::, <cctype>) +SYMBOL(isdigit, std::, <cctype>) SYMBOL(isfinite, std::, <cmath>) +SYMBOL(isgraph, std::, <cctype>) 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(islower, std::, <cctype>) SYMBOL(isnan, std::, <cmath>) SYMBOL(isnormal, std::, <cmath>) SYMBOL(ispow2, std::, <bit>) +SYMBOL(isprint, std::, <cctype>) +SYMBOL(ispunct, std::, <cctype>) +SYMBOL(isspace, std::, <cctype>) SYMBOL(istream_iterator, std::, <iterator>) SYMBOL(istreambuf_iterator, std::, <iterator>) SYMBOL(istringstream, std::, <sstream>) SYMBOL(isunordered, std::, <cmath>) +SYMBOL(isupper, std::, <cctype>) SYMBOL(iswalnum, std::, <cwctype>) SYMBOL(iswalpha, std::, <cwctype>) SYMBOL(iswblank, std::, <cwctype>) @@ -636,6 +657,7 @@ SYMBOL(iswspace, std::, <cwctype>) SYMBOL(iswupper, std::, <cwctype>) SYMBOL(iswxdigit, std::, <cwctype>) +SYMBOL(isxdigit, std::, <cctype>) SYMBOL(iter_swap, std::, <algorithm>) SYMBOL(iterator, std::, <iterator>) SYMBOL(iterator_traits, std::, <iterator>) @@ -663,6 +685,8 @@ SYMBOL(localtime, std::, <ctime>) SYMBOL(lock, std::, <mutex>) SYMBOL(lock_guard, std::, <mutex>) +SYMBOL(log, std::, <cmath>) +SYMBOL(log10, std::, <cmath>) SYMBOL(log1p, std::, <cmath>) SYMBOL(log2, std::, <cmath>) SYMBOL(log2p1, std::, <bit>) @@ -824,6 +848,7 @@ SYMBOL(polar, std::, <complex>) SYMBOL(polymorphic_allocator, std::, <memory_resource>) SYMBOL(pop_heap, std::, <algorithm>) +SYMBOL(pow, std::, <cmath>) SYMBOL(prev, std::, <iterator>) SYMBOL(prev_permutation, std::, <algorithm>) SYMBOL(printf, std::, <cstdio>) @@ -886,6 +911,7 @@ SYMBOL(regex_traits, std::, <regex>) SYMBOL(reinterpret_pointer_cast, std::, <memory>) SYMBOL(remainder, std::, <cmath>) +SYMBOL(remove, std::, <cstdio>) SYMBOL(remove_all_extents, std::, <type_traits>) SYMBOL(remove_all_extents_t, std::, <type_traits>) SYMBOL(remove_const, std::, <type_traits>) @@ -970,6 +996,8 @@ SYMBOL(sig_atomic_t, std::, <csignal>) SYMBOL(signal, std::, <csignal>) SYMBOL(signbit, std::, <cmath>) +SYMBOL(sin, std::, <cmath>) +SYMBOL(sinh, std::, <cmath>) SYMBOL(size, std::, <iterator>) SYMBOL(skipws, std::, <ios>) SYMBOL(slice, std::, <valarray>) @@ -980,6 +1008,7 @@ SYMBOL(sort_heap, std::, <algorithm>) SYMBOL(span, std::, <span>) SYMBOL(sprintf, std::, <cstdio>) +SYMBOL(sqrt, std::, <cmath>) SYMBOL(srand, std::, <cstdlib>) SYMBOL(sregex_iterator, std::, <regex>) SYMBOL(sregex_token_iterator, std::, <regex>) @@ -1038,6 +1067,8 @@ SYMBOL(system, std::, <cstdlib>) SYMBOL(system_category, std::, <system_error>) SYMBOL(system_error, std::, <system_error>) +SYMBOL(tan, std::, <cmath>) +SYMBOL(tanh, std::, <cmath>) SYMBOL(tera, std::, <ratio>) SYMBOL(terminate, std::, <exception>) SYMBOL(terminate_handler, std::, <exception>) @@ -1062,6 +1093,8 @@ SYMBOL(to_chars, std::, <charconv>) SYMBOL(to_integer, std::, <cstddef>) SYMBOL(to_string, std::, <string>) +SYMBOL(tolower, std::, <cctype>) +SYMBOL(toupper, std::, <cctype>) SYMBOL(towctrans, std::, <cwctype>) SYMBOL(towlower, std::, <cwctype>) SYMBOL(towupper, std::, <cwctype>) @@ -1118,6 +1151,7 @@ SYMBOL(upper_bound, std::, <algorithm>) SYMBOL(uppercase, std::, <ios>) SYMBOL(use_facet, std::, <locale>) +SYMBOL(uses_allocator, std::, <memory>) SYMBOL(uses_allocator_v, std::, <memory>) SYMBOL(va_list, std::, <cstdarg>) SYMBOL(valarray, std::, <valarray>)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits