<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thanks Steve, this worked.  Although I had to use a slightly different endBuf, because the Lexer was complaining:</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "> <span style="color: #aa0d91"></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span style="color: #aa0d91">const</span> <span style="color: #aa0d91">char</span> *endBuf = SM-><span style="color: #2e0d6e">getBufferData</span>(LocStart.<span style="color: #2e0d6e">getFileID</span>()).<span style="color: #5c2699">second</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">So that solution works for now, but it's on my wish list for having in clang.  Relatedly, one other thing for the wish list: the SourceLocation for the superclass name. For example, the location of token between the ':' and the '{' here:</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">@interface MyClass : MySuperClass {</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">Thanks again,</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">e</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px;">  </span></font></div></div><br><div><html>On Apr 10, 2008, at 3:11 PM, Steve Naroff wrote:</html><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 10, 2008, at 2:46 PM, Emerson Murphy-Hill wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Howdy Steve,<br><br>I asked Ted this question, but he suggested you might have a better way to do this.  I have an ObjCInterfaceDecl and I need the location of the name of the interface.  That is:<br><br>@interface MyClass<br>                   ^              ^<br>            Here               to Here<br><br>There's no AST node for that, as far as I know.  Ted suggested using the Lexer, like TextDiagnosticPrinter does, but also thought there might be an easier way.  Is there?<br><br></blockquote><div><br class="webkit-block-placeholder"></div><div>As you noticed, we don't have location info for all interface components. Currently, we only store a SourceLocation for the beginning/middle/end. We could certainly add more SourceLocations if necessary (since I'm not too concerned about the size of an ObjCInterfaceDecl).</div><div><br class="webkit-block-placeholder"></div><div>That said, at the moment, here is the idiom for obtaining a pointer to the characters (I do this in the rewriter).</div><div><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #3f6e74">SourceLocation</span> LocStart = CDecl-><span style="color: #26474b">getLocStart</span>(); // beginning</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #3f6e74">SourceLocation</span> LocEnd = CDecl-><span style="color: #26474b">getLocEnd</span>(); // <span class="Apple-style-span" style="color: rgb(0, 116, 0); ">marks the '>', '}', or identifier</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: rgb(63, 110, 116); ">SourceLocation</span> LocAtEnd = CDecl-><span style="color: rgb(38, 71, 75); ">getAtEndLoc</span>(); // @end</div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: rgb(63, 110, 116); ">SourceManager<span style="color: rgb(0, 0, 0); "> *</span>SM<span style="color: rgb(0, 0, 0); ">; // set elsewhere, obviously</span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #aa0d91">const</span> <span style="color: #aa0d91">char</span> *startBuf = <span style="color: #3f6e74">SM</span>-><span style="color: #26474b">getCharacterData</span>(LocStart);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">  <span style="color: #aa0d91">const</span> <span style="color: #aa0d91">char</span> *endBuf = <span style="color: #3f6e74">SM</span>-><span style="color: #26474b">getCharacterData</span>(LocEnd);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; "><span class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><div>At this point, you can use a Lexer to "formally" tokenize the buffer or you can do adhoc string manipulation (it's your call).</div><div><br class="webkit-block-placeholder"></div><div>Let me know if this works for you. </div><div><br class="webkit-block-placeholder"></div><div>snaroff</div><div><br class="webkit-block-placeholder"></div></span></div> <blockquote type="cite">Thanks,<br><br>Emerson<br></blockquote></div><br></div></blockquote></div><br></body></html>