<div dir="ltr">I need those locations in order to retain comments and indentation by simply doing a text replace instead of rebuilding the text.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 18, 2014 at 2:13 AM, Eli Bendersky <span dir="ltr"><<a href="mailto:eliben@google.com" target="_blank">eliben@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Sep 17, 2014 at 3:55 PM, Mihai Draghicioiu <span dir="ltr"><<a href="mailto:mihai.draghicioiu@gmail.com" target="_blank">mihai.draghicioiu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi guys. I'm trying to get a SourceLocation for a couple of points in the source. So for:<div><br></div><div><font face="courier new, monospace">class Foo<b><HERE></b>: public Bar <b><AND HERE></b>{</font></div><div><font face="courier new, monospace"><br></font></div>Starting from a CXXRecordDecl (which I get from RecursiveASTVisitor::VisitCXXRecordDecl()), currently I am only able to get the location before the <i>class</i> keyword (with TagDecl::getInnerLocStart()) and after it (TagDecl::getOuterLocStart()).<div><br></div><div>I've been struggling with this for a while now, and the documentation really isn't helping. There are many missing enums and member functions in the docs. Am I supposed to use the lexer somehow? How? Am I supposed to use VisitTypeLoc()? I dunno, help!</div><div><br></div><div>This is for a source translation tool that translates a small subset of C++ to JS. So:</div><div><br></div><div><font face="courier new, monospace">class Foo: public Bar {</font></div><div><font face="courier new, monospace">    Foo(int x, float y) {</font></div><div><br></div><div>Becomes:</div><div><br></div><div><font face="courier new, monospace">function Foo(x, y) {</font></div><div><font face="courier new, monospace">...</font></div><div><font face="courier new, monospace">}</font></div><div><font face="courier new, monospace">// Do some inheritance stuff for Bar</font></div></div></blockquote><div><br></div></div></div><div>Why do you need those particular source locations to perform this task, though? Sounds like all you need is find the class name, its base(s) and constructor(s) - all that is readily available in the AST.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Eli</div><div><br></div><div> </div></font></span></div></div></div>
</blockquote></div><br></div>