<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63875>63875</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
libclang not traversing all nodes in some cases
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kunaljaydesai
</td>
</tr>
</table>
<pre>
Hi, I am running into an issue where a cursor's descendants change when I have an `#include <utility>` at the top vs. when I don't. Here is a minimally reproducible example:
```python
import clang.cindex
clang.cindex.Config.set_library_file("...")
args = '-x c++ --std=c++11'.split()
index = clang.cindex.Index.create()
tu = index.parse("main.h", args=args)
def visit_children(node):
node_file_name = str(node.location.file)
if "main.h" in node_file_name:
print(node.spelling, node.displayname, node.kind, node.get_usr())
for c in node.get_children():
visit_children(c)
visit_children(tu.cursor)
```
Without `#include <utility>` in `main.h`
```cpp
template <typename L>
using Single = L;
Single<int> testFn();
```
and
With `#include <utility>` in `main.h`
```cpp
template <typename L>
using Single = L;
Single<int> testFn();
```
When `#include <utility>` isn't in the CPP file, this is the output of the Python script:
```
Single Single CursorKind.TYPE_ALIAS_TEMPLATE_DECL c:@Single
L L CursorKind.TEMPLATE_TYPE_PARAMETER c:main.h@29
Single Single CursorKind.TYPE_ALIAS_DECL c:@Single
L L CursorKind.TYPE_REF
testFn testFn() CursorKind.FUNCTION_DECL c:@F@testFn#
```
When `#include <utility>` is in the CPP file, this is the output of the Python script:
```
Single Single CursorKind.TYPE_ALIAS_TEMPLATE_DECL c:@Single
L L CursorKind.TEMPLATE_TYPE_PARAMETER c:main.h@10
Single Single CursorKind.TYPE_ALIAS_DECL c:@Single
L L CursorKind.TYPE_REF
testFn testFn() CursorKind.FUNCTION_DECL c:@F@testFn#
Single Single CursorKind.TEMPLATE_REF
```
Notice that in the second output, the last line includes `Single Single CursorKind.TEMPLATE_REF` whereas, in the first output, this line does not exist. Is this a bug? If not, why is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