<div dir="ltr">Hi,<br><br>I'm having a problem getting the relevant code of a TypeDecl.<br>Given the following code:<br><blockquote>typedef struct MyStruct {<br>        int x;<br>        int y;<br>} MyStruct;<br></blockquote>

<br>I would like to get it all.<br>In my ASTConsumer I'm actually getting 2 TypeDecls for the above code: Typedef and Record.<br>I assume it'ss because the above code is a syntactic sugar for:<br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">

struct MyStruct {<br>
        int x;<br>
        int y;<br>
};`<br><br>typedef struct MyStruct MyStruct;<br></blockquote><div><br><br>So far so good, but when I try to print the Decls using <i>Decl::print</i> or <i>SourceManager::getCharacterData</i> sending the SourceRange of the Decl,<br>

I get the following output:<br><br></div><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">Decl Kind: Record<br>Character Data: <br>struct MyStruct {<br>

        int x;<br>        int y;<br>}<br><br>Pretty-print: struct<br></blockquote><br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">Decl Kind: Typedef<br>

Character Data: <br>Pretty-print: typedef MyStruct MyStruct<br></blockquote><div><br><br>There are some issues here that either I don't understand, or it's a bug.<br><ol><li>For the Record, why the pretty print does not print the whole expression?<br>

>From the documentation I've understood that the output of pretty print should be close to the original source.</li><li>For the Typedef, I don't understand why I'm getting an empty string from <i>SourceManager::getCharacterData.</i></li>

<li>Also I don't understand the pretty-print of the Typedef. Shouldn't it be:<br>typedef <b>struct</b> MyStruct MyStruct  ?</li></ol><br>Any help or suggestions will be much appreciated.<br><br>Thanks in advance,<br>

Ilya<br> </div><br clear="all"><br>-- <br><div dir="ltr">Best Regards,<br>Ilya Mirsky<br><a href="http://www.cs.bgu.ac.il/%7Emirskyil" target="_blank">www.cs.bgu.ac.il/~mirskyil</a><br></div><br>
</div>