[llvm-bugs] [Bug 37746] New: ObjCIvarDecl::getParent is not valid
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jun 8 03:09:13 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37746
Bug ID: 37746
Summary: ObjCIvarDecl::getParent is not valid
Product: clang
Version: 6.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: mh+llvm at glandium.org
CC: llvm-bugs at lists.llvm.org
I'm not sure how this worked in clang 5, but we have a clang plugin for
https://searchfox.org/ that gets data during compilation, and that does this:
https://searchfox.org/mozilla-central/rev/c621276fbdd9591f52009042d959b9e19b66d49f/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp#377-380
} 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180608/e60618a4/attachment.html>
More information about the llvm-bugs
mailing list