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: unassignedclangb...@nondot.org
Reporter: mh+l...@glandium.org
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs