diff --git a/clang/tools/include-mapping/cppreference_parser.py b/clang/tools/include-mapping/cppreference_parser.py --- a/clang/tools/include-mapping/cppreference_parser.py +++ b/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):