[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.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 00:36:56 PST 2023


hokein added inline comments.


================
Comment at: clang/tools/include-mapping/cppreference_parser.py:117
 def _ReadSymbolPage(path, name):
-  with open(path) as f:
-    return _ParseSymbolPage(f.read(), name)
+  try:
+    f = open(path)
----------------
so the input path can be invalid, pointing to a non-existing file, I'd just check it in the caller side, see my other comment.


================
Comment at: clang/tools/include-mapping/cppreference_parser.py:153
         continue
       path = os.path.join(root_dir, symbol_page_path)
       results.append((symbol_name,
----------------
I think just adding a file-existing check would work:

```
if os.path.isfile(path):
   results.append((symbol_name,
                      pool.apply_async(_ReadSymbolPage, (path, symbol_name))))
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141509/new/

https://reviews.llvm.org/D141509



More information about the cfe-commits mailing list