<div dir="ltr">I thought so too but from the documentation:<div><br></div><div><div>  /// isAnonymousStructOrUnion - Whether this is an anonymous struct</div><div>  /// or union. To be an anonymous struct or union, it must have been</div><div>  /// declared without a name and there must be no objects of this</div><div>  /// type declared, e.g.,</div><div>  /// @code</div><div>  ///   union { int i; float f; };</div><div>  /// @endcode</div><div>  /// is an anonymous union but neither of the following are:</div><div>  /// @code</div><div>  ///  union X { int i; float f; };</div><div>  ///  <b>union { int i; float f; } obj</b>;</div><div>  /// @endcode</div></div><div><br></div><div>So I thought that it would create a tag name using the field name, which doesn't seem to be the case.</div><div><br></div><div>Anyway, I decided to follow the cope from <a href="http://clang.llvm.org/doxygen/TypePrinter_8cpp_source.html#l00906" target="_blank">TypePrinter</a> and ignore a struct without name when generating the scope.</div><div><br></div><div>Thank you,</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-09 8:34 GMT+01:00 Miklos Vajna via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On Fri, May 06, 2016 at 01:02:43PM +0100, Mikhail Ramalho via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> typedef struct<br>
> {<br>
>   int __count;<br>
><br>
> *  union*<br>
> *  {*<br>
> *    int __wch;*<br>
> *    char __wchb[4];*<br>
> *  } __value;*<br>
><br>
> } __mbstate_t;<br>
<br>
...<br>
<span><br>
> The problem is the inner union, which is not anonymous but I can't get the<br>
> name. The bold assertion always fails.<br>
<br>
</span>Have a look at the AST with 'clang++ -Xclang -ast-dump -fsyntax-only',<br>
IIUC the union is anonymous, __value is the name of the member, not of<br>
the union.<br>
<br>
Regards,<br>
<br>
Miklos<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</div></div>