<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 - hasName AST matcher is confused by extern "C" in namespace"
href="https://bugs.llvm.org/show_bug.cgi?id=42193">42193</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>hasName AST matcher is confused by extern "C" in namespace
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kpreisert@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Given the following code:
namespace foo {
extern "C" void test() {}
}
... I expect an AST matcher declared as functionDecl(hasName("::foo::test")) to
match the function, but functionDecl(hasName("::test")) should not match.
However, the opposite is the case. (see the example on Compiler Explorer:
<a href="http://ce.steveire.com/z/VDTi_g">http://ce.steveire.com/z/VDTi_g</a>)
When I do this locally with a build with assertions, I get an assertion failure
at
<a href="https://github.com/llvm/llvm-project/blob/bca56ab073a00cdec8e0995e3119baf25cf775b8/clang/lib/ASTMatchers/ASTMatchersInternal.cpp#L540">https://github.com/llvm/llvm-project/blob/bca56ab073a00cdec8e0995e3119baf25cf775b8/clang/lib/ASTMatchers/ASTMatchersInternal.cpp#L540</a>,
so I think the problem is that matchesNodeFullFast does not correctly handle
extern "C" functions.</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>