Skip to content

Commit

Permalink
[clang][docs] Defensively turn off exception behavior in dump_ast_mat…
Browse files Browse the repository at this point in the history
…chers.py

Differential Revision: https://reviews.llvm.org/D155134
  • Loading branch information
t-rasmud committed Jul 18, 2023
1 parent 3ea673a commit 1e62587
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions clang/docs/tools/dump_ast_matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
try:
CLASS_INDEX_PAGE = urlopen(CLASS_INDEX_PAGE_URL).read().decode("utf-8")
except Exception as e:
raise Exception("Unable to get %s: %s" % (CLASS_INDEX_PAGE_URL, e))
CLASS_INDEX_PAGE = None
print("Unable to get %s: %s" % (CLASS_INDEX_PAGE_URL, e))

MATCHERS_FILE = "../../include/clang/ASTMatchers/ASTMatchers.h"

Expand Down Expand Up @@ -58,7 +59,10 @@ def link_if_exists(m):
url = "https://clang.llvm.org/doxygen/classclang_1_1%s.html" % name
if url not in doxygen_probes:
search_str = 'href="classclang_1_1%s.html"' % name
doxygen_probes[url] = search_str in CLASS_INDEX_PAGE
if CLASS_INDEX_PAGE is not None:
doxygen_probes[url] = search_str in CLASS_INDEX_PAGE
else:
doxygen_probes[url] = True
if not doxygen_probes[url]:
print("Did not find %s in class index page" % name)
if doxygen_probes[url]:
Expand Down Expand Up @@ -186,7 +190,7 @@ def act_on_decl(declaration, comment, allowed_types):
"""
if declaration.strip():

if re.match(r"^\s?(#|namespace|using)", declaration):
if re.match(r"^\s?(#|namespace|using|template <typename NodeType> using|})", declaration):
return

# Node matchers are defined by writing:
Expand Down

0 comments on commit 1e62587

Please sign in to comment.