<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 - ObjCIvarDecl::getParent is not valid"
href="https://bugs.llvm.org/show_bug.cgi?id=37746">37746</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ObjCIvarDecl::getParent is not valid
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mh+llvm@glandium.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I'm not sure how this worked in clang 5, but we have a clang plugin for
<a href="https://searchfox.org/">https://searchfox.org/</a> that gets data during compilation, and that does this:
<a href="https://searchfox.org/mozilla-central/rev/c621276fbdd9591f52009042d959b9e19b66d49f/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp#377-380">https://searchfox.org/mozilla-central/rev/c621276fbdd9591f52009042d959b9e19b66d49f/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp#377-380</a>
} else if (const FieldDecl *D2 = dyn_cast<FieldDecl>(Decl)) {
const RecordDecl *Record = D2->getParent();
return std::string("F_<") + getMangledName(Ctx, Record) + ">_" +
toString(D2->getFieldIndex());
This crashes in getMangledName() because Record is not a valid object. The
problem being that we reach here with a ObjCIvarDecl, which inherits FieldDecl,
so the dyn_cast is valid. But the DeclContext for ObjCIvarDecl is a
ObjCContainerDecl (per ObjCIvarDecl::Create), which doesn't inherit RecordDecl.
Maybe things somehow aligned by chance in 5.0, but they blow up in 6.0.</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>