| Issue |
63875
|
| Summary |
libclang not traversing all nodes in some cases
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
kunaljaydesai
|
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 this happening?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs