</pre></td></tr>
+<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isInAnonymousNamespace0')"><a name="isInAnonymousNamespace0Anchor">isInAnonymousNamespace</a></td><td></td></tr>
+<tr><td colspan="4" class="doc" id="isInAnonymousNamespace0"><pre>Matches declarations in an anonymous namespace.
+
+Given
+ class vector {};
+ namespace foo {
+ class vector {};
+ namespace {
+ class vector {}; // #1
+ }
+ }
+ namespace {
+ class vector {}; // #2
+ namespace foo {
+ class vector{}; // #3
+ }
+ }
+cxxRecordDecl(hasName("vector"), isInAnonymousNamespace()) will match
+#1, #2 and #3.
+</pre></td></tr>
+
+
<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isInStdNamespace0')"><a name="isInStdNamespace0Anchor">isInStdNamespace</a></td><td></td></tr>
<tr><td colspan="4" class="doc" id="isInStdNamespace0"><pre>Matches declarations in the namespace `std`, but not in nested namespaces.
cxxRecordDecl(hasName("vector"), isInStdNamespace()) will match only #1.
</pre></td></tr>
-<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isInAnonymousNamespace0')"><a name="isInAnonymousNamespace0Anchor">isInAnonymousNamespace</a></td><td></td></tr>
-<tr><td colspan="4" class="doc" id="isInAnonymousNamespace0"><pre>Matches declarations in an anonymous namespace.
-
-Given
- class vector {};
- namespace foo {
- class vector {};
- namespace {
- class vector {}; // #1
- }
- }
- namespace {
- class vector {}; // #2
- namespace foo {
- class vector{}; // #3
- }
- }
-cxxRecordDecl(hasName("vector"), isInAnonymousNamespace()) will match #1, #2 and #3.
-</pre></td></tr>
<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('isInstantiated0')"><a name="isInstantiated0Anchor">isInstantiated</a></td><td></td></tr>
<tr><td colspan="4" class="doc" id="isInstantiated0"><pre>Matches declarations that are template instantiations or are inside
</pre></td></tr>
-<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>></td><td class="name" onclick="toggle('capturesVar0')"><a name="capturesVar0Anchor">capturesVar</a></td><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>> InnerMatcher</td></tr>
+<tr><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1LambdaCapture.html">LambdaCapture</a>></td><td class="name" onclick="toggle('capturesVar0')"><a name="capturesVar0Anchor">capturesVar</a></td><td>Matcher<<a href="https://clang.llvm.org/doxygen/classclang_1_1ValueDecl.html">ValueDecl</a>> InnerMatcher</td></tr>
<tr><td colspan="4" class="doc" id="capturesVar0"><pre>Matches a `LambdaCapture` that refers to the specified `VarDecl`. The
`VarDecl` can be a separate variable that is captured by value or
reference, or a synthesized variable if the capture has an initializer.
-#!/usr/bin/env python
+#!/usr/bin/env python3
# A tool to parse ASTMatchers.h and update the documentation in
# ../LibASTMatchersReference.html automatically. Run from the
# directory in which this file is located to update the docs.
CLASS_INDEX_PAGE_URL = 'https://clang.llvm.org/doxygen/classes.html'
try:
- CLASS_INDEX_PAGE = urlopen(CLASS_INDEX_PAGE_URL).read()
+ 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))
m = re.match(r'(?:^|.*\s+)internal::(?:Bindable)?Matcher<([^>]+)>$', result)
if m:
result_types = [m.group(1)]
- if template_name and len(result_types) is 1 and result_types[0] == template_name:
+ if template_name and len(result_types) == 1 and result_types[0] == template_name:
result_types = ['*']
else:
result_types = extract_result_types(comment)
reference = re.sub(r'<!-- START_TRAVERSAL_MATCHERS.*END_TRAVERSAL_MATCHERS -->',
traversal_matcher_table, reference, flags=re.S)
-with open('../LibASTMatchersReference.html', 'wb') as output:
+with open('../LibASTMatchersReference.html', 'w', newline='\n') as output:
output.write(reference)