<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Incorrect CursorKind for lambda expression"
href="https://bugs.llvm.org/show_bug.cgi?id=48103">48103</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Incorrect CursorKind for lambda expression
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>libclang
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>s.zvyagin83@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24140" name="attach_24140" title="python script for parsing C++ source and printing AST">attachment 24140</a> <a href="attachment.cgi?id=24140&action=edit" title="python script for parsing C++ source and printing AST">[details]</a></span>
python script for parsing C++ source and printing AST
this is minimal example
template<class Callable>
void call_func(Callable func);
void foo()
{
call_func([&]() {});
}
libclang10 identifies lambda parameter as CursorKind.LAMBDA_EXPR but it changed
to CursorKind.OBJ_BOOL_LITERAL_EXPR in libclang11
This is tree dump for 11 version
./print_ast.py
{'ResourceDir': '/usr/lib64/llvm/11/bin/../../../../lib/clang/11.0.0',
'LibDir': '/usr/lib/llvm/11/lib64'}
None:0 0 l.cpp CursorKind.TRANSLATION_UNIT
l.cpp:2 1 l.cpp.call_func CursorKind.FUNCTION_TEMPLATE
l.cpp:1 2 l.cpp.call_func.Callable CursorKind.TEMPLATE_TYPE_PARAMETER
l.cpp:2 2 l.cpp.call_func.func CursorKind.PARM_DECL
l.cpp:2 3 l.cpp.call_func.func.Callable CursorKind.TYPE_REF
l.cpp:4 1 l.cpp.foo CursorKind.FUNCTION_DECL
l.cpp:5 2 l.cpp.foo. CursorKind.COMPOUND_STMT
l.cpp:6 3 l.cpp.foo.. CursorKind.UNEXPOSED_EXPR
l.cpp:6 4 l.cpp.foo...call_func CursorKind.CALL_EXPR
l.cpp:6 5 l.cpp.foo...call_func.call_func CursorKind.UNEXPOSED_EXPR
l.cpp:6 6 l.cpp.foo...call_func.call_func.call_func CursorKind.DECL_REF_EXPR
l.cpp:6 5 l.cpp.foo...call_func. CursorKind.CALL_EXPR
l.cpp:6 6 l.cpp.foo...call_func.. CursorKind.UNEXPOSED_EXPR
l.cpp:6 7 l.cpp.foo...call_func... CursorKind.OBJ_BOOL_LITERAL_EXPR
l.cpp:6 8 l.cpp.foo...call_func.... CursorKind.COMPOUND_STMT
This is for 10
./print_ast.py
{'ResourceDir': '/usr/lib64/llvm/10/bin/../../../../lib/clang/10.0.1',
'LibDir': '/usr/lib/llvm/10/lib64'}
None:0 0 l.cpp CursorKind.TRANSLATION_UNIT
l.cpp:2 1 l.cpp.call_func CursorKind.FUNCTION_TEMPLATE
l.cpp:1 2 l.cpp.call_func.Callable CursorKind.TEMPLATE_TYPE_PARAMETER
l.cpp:2 2 l.cpp.call_func.func CursorKind.PARM_DECL
l.cpp:2 3 l.cpp.call_func.func.Callable CursorKind.TYPE_REF
l.cpp:4 1 l.cpp.foo CursorKind.FUNCTION_DECL
l.cpp:5 2 l.cpp.foo. CursorKind.COMPOUND_STMT
l.cpp:6 3 l.cpp.foo.. CursorKind.UNEXPOSED_EXPR
l.cpp:6 4 l.cpp.foo...call_func CursorKind.CALL_EXPR
l.cpp:6 5 l.cpp.foo...call_func.call_func CursorKind.UNEXPOSED_EXPR
l.cpp:6 6 l.cpp.foo...call_func.call_func.call_func CursorKind.DECL_REF_EXPR
l.cpp:6 5 l.cpp.foo...call_func. CursorKind.CALL_EXPR
l.cpp:6 6 l.cpp.foo...call_func.. CursorKind.UNEXPOSED_EXPR
l.cpp:6 7 l.cpp.foo...call_func... CursorKind.LAMBDA_EXPR
l.cpp:6 8 l.cpp.foo...call_func.... CursorKind.COMPOUND_STMT
Notice how child of CALL_EXPR.UNEXPOSED_EXPR is changed in new version.
There is no way anymore to detect lambda call in AST</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>