<div dir="ltr">Sounds like an obj-c bug. The FieldDecl is probably actually an ObjCIvarDecl, and you probably want to use getContainingInterface() instead if it is. ObjCInterfaceDecl don't inherit from RecordDecl, so getParent() can't work as written.<div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 28, 2015 at 9:21 AM, Stephan Bergmann <span dir="ltr"><<a href="mailto:sbergman@redhat.com" target="_blank">sbergman@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">At least on recent trunk, FieldDecl::getParent() does<br>
<br>
  return cast<RecordDecl>(getDeclContext());<br>
<br>
and I noticed some plugin calling it crashing with a failed assertion<br>
<br>
  (isa<X>(Val) && "cast<Ty>() argument of incompatible type!")<br>
<br>
when getDeclContext() happened to be an ObjCInterfaceDecl.<br>
<br>
Is FieldDecl::getParent() known to only be callable under certain circumstances (i.e., the plugin broken), or is something else broken?<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>