[PATCH] D141509: [include-mapping] Fix parsing of html_book_20190607.zip (https://en.cppreference.com/w/File:html_book_20190607.zip). Skip entries that have been added to the index (C++20 symbols), but the corresponding pages for which have not been created yet.
Viktoriia Bakalova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 11 08:22:43 PST 2023
VitaNuo created this revision.
VitaNuo added a reviewer: hokein.
Herald added a subscriber: arphaman.
Herald added a project: All.
VitaNuo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141509
Files:
clang/tools/include-mapping/cppreference_parser.py
Index: clang/tools/include-mapping/cppreference_parser.py
===================================================================
--- clang/tools/include-mapping/cppreference_parser.py
+++ clang/tools/include-mapping/cppreference_parser.py
@@ -114,8 +114,17 @@
def _ReadSymbolPage(path, name):
- with open(path) as f:
- return _ParseSymbolPage(f.read(), name)
+ try:
+ f = open(path)
+ except FileNotFoundError as e:
+ # Some entries exist in the index, but their corresponding pages have not
+ # been written yet (i.e., they are "red links"). When trying to open such
+ # a page, it redirects to a generic error page with "redlink=1" in the URL.
+ if "redlink" in str(e):
+ return []
+ raise
+ with f:
+ return _ParseSymbolPage(f.read(), name)
def _GetSymbols(pool, root_dir, index_page_name, namespace, variants_to_accept):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141509.488232.patch
Type: text/x-patch
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230111/38966abd/attachment.bin>
More information about the cfe-commits
mailing list