<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 20, 2017 at 9:00 AM Paul Robinson via Phabricator via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">probinson added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D41264#959575" rel="noreferrer" target="_blank">https://reviews.llvm.org/D41264#959575</a>, @aprantl wrote:<br>
<br>
>   0x00000068:     DW_TAG_typedef<br>
>                     DW_AT_name        ("_Nodeptr")<br>
>                     DW_AT_decl_file   ("/tmp/t.cpp")<br>
>                     DW_AT_decl_line   (2)<br>
><br>
>   0x0000006f:     NULL<br>
><br>
><br>
> this also looks weird, but is apparently sort of legal DWARF:<br>
><br>
> > For example, in C and C++ the language implementation can provide an unspecified type entry with the name “void” which can be referenced by the type attribute of pointer types and typedef declarations for ’void’.<br>
><br>
> although it would be nicer to use DW_TAG_unspecified_type instead.<br>
><br>
> Based on this it looks like we should allow this case.<br>
<br>
<br>
I didn't think it was legal either, but the description of DW_TAG_typedef does say it "may" have a DW_AT_type, and even discusses when it's appropriate to leave it out.<br>
<br>
Using `void` as the return type of a subprogram is explicitly represented as omitting DW_AT_type from the subprogram DIE, and that's probably where the nullptr idea came from.<br>
<br>
A typedef of `void *`  goes to a DW_TAG_pointer_type which is required to have at DW_AT_type, which I think we do emit as DW_TAG_unspecified_type.  So, for consistency I'd think we might want typedef to do something similar.  But, omitting is legal.<br></blockquote><div><br>Seems Clang and GCC both emit void* as a DW_TAG_pointer_type without any DW_AT_type attribute, FWIW. (minor difference: GCC puts a DW_AT_byte_size on it, and Clang omits that)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D41264" rel="noreferrer" target="_blank">https://reviews.llvm.org/D41264</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>