[include-mapping] Regenerate the StdSymbolMap.inc from the 20220730 html book.

Merge the zoombie names into the StdSymbols as well.

Differential Revision: https://reviews.llvm.org/D143054
This commit is contained in:
Viktoriia Bakalova 2023-02-03 10:02:01 +01:00 committed by Haojian Wu
parent b716bf84ea
commit 4da283872a
3 changed files with 512 additions and 82 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,11 @@ class Symbol:
# a list of corresponding headers
self.headers = headers
def __lt__(self, other):
if self.namespace != other.namespace:
return self.namespace < other.namespace
return self.name < other.name
def _HasClass(tag, *classes):
for c in tag.get('class', []):
@ -147,7 +152,7 @@ def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept):
pool.apply_async(_ReadSymbolPage, (path, symbol_name))))
else:
sys.stderr.write("Discarding information for symbol: %s. Page %s does not exist.\n"
% (symbol_name, path))
% (symbol_name, path))
# Build map from symbol name to a set of headers.
symbol_headers = collections.defaultdict(set)
@ -185,4 +190,4 @@ def GetSymbols(parse_pages):
finally:
pool.terminate()
pool.join()
return symbols
return sorted(symbols)

View File

@ -22,15 +22,13 @@ Caveats and FIXMEs:
Usage:
1. Install BeautifulSoup dependency, see instruction:
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-beautiful-soup
2. Download cppreference offline HTML files (e.g. html_book_20181028.zip) at
2. Download cppreference offline HTML files (html_book_20220730.zip in Unofficial Release) at
https://en.cppreference.com/w/Cppreference:Archives
3. Unzip the zip file from step 2 (e.g., to a "cppreference" directory). You should
get a "cppreference/reference" directory.
4. Run the command:
// Generate C++ symbols
python3 gen_std.py -cppreference cppreference/reference -symbols=cpp > StdSymbolMap.inc
// Generate C++ removed symbols
python3 gen_std.py -cppreference cppreference/reference -symbols=cpp_removed > RemovedSymbolMap.inc
// Generate C symbols
python3 gen_std.py -cppreference cppreference/reference -symbols=c > CSymbolMap.inc
"""
@ -191,11 +189,10 @@ def main():
(symbol_index_root, "pmr.html", "std::pmr::"),
(symbol_index_root, "regex_constants.html", "std::regex_constants::"),
(symbol_index_root, "this_thread.html", "std::this_thread::"),
# Zombie symbols that were available from the Standard Library, but are
# removed in the following standards.
(symbol_index_root, "zombie_names.html", "std::"),
]
elif args.symbols == 'cpp_removed':
page_root = os.path.join(args.cppreference, "en", "cpp")
symbol_index_root = os.path.join(page_root, "symbol_index")
parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
elif args.symbols == 'c':
page_root = os.path.join(args.cppreference, "en", "c")
symbol_index_root = page_root