<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">I played around a bit after trying to understand Argyrios' adaptions for makeFileCharRange, and came up with this:</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Pastebin:<br><div><a href="http://pastebin.com/g4ny0vbq" target="_blank">http://pastebin.com/g4ny0vbq</a><br></div><div><br></div><div>Pasted into mail (will probalby not format well in most mail programs):</div>
<div><div>Loc</div><div>|-Expansion      </div><div>| |-ExpansionStart </div><div>| | |-ExpansionStart </div><div>| | | |-ExpansionStart :4:1,</div><div>| | | |-ExpansionEnd   :4:16,</div><div>| | | `-Spelling       :3:16,</div>
<div>| | |-ExpansionEnd   </div><div>| | | |-ExpansionStart :4:1,</div><div>| | | |-ExpansionEnd   :4:16,</div><div>| | | `-Spelling       :3:19,</div><div>| | `-Spelling       :2:14,</div><div>| |-ExpansionEnd   </div><div>
| | |-ExpansionStart </div><div>| | | |-ExpansionStart :4:1,</div><div>| | | |-ExpansionEnd   :4:16,</div><div>| | | `-Spelling       :3:16,</div><div>| | |-ExpansionEnd   </div><div>| | | |-ExpansionStart :4:1,</div><div>
| | | |-ExpansionEnd   :4:16,</div><div>| | | `-Spelling       :3:19,</div><div>| | `-Spelling       :2:17,</div><div>| `-Spelling       :1:14,</div><div>`-Spelling       </div><div>  |-Expansion      </div><div>  | |-ExpansionStart </div>
<div>  | | |-ExpansionStart :4:1,</div><div>  | | |-ExpansionEnd   :4:16,</div><div>  | | `-Spelling       :3:16,</div><div>  | |-ExpansionEnd   </div><div>  | | |-ExpansionStart :4:1,</div><div>  | | |-ExpansionEnd   :4:16,</div>
<div>  | | `-Spelling       :3:19,</div><div>  | `-Spelling       :2:16,</div><div>  `-Spelling       </div><div>    |-Expansion      </div><div>    | |-ExpansionStart :4:1,</div><div>    | |-ExpansionEnd   :4:16,</div><div>
    | `-Spelling       :3:18,</div><div>    `-Spelling       </div><div>      |-Expansion      </div><div>      | |-ExpansionStart </div><div>      | | |-ExpansionStart </div><div>      | | | |-ExpansionStart :4:3,</div><div>
      | | | |-ExpansionEnd   :4:15,</div><div>      | | | `-Spelling       :3:16,</div><div>      | | |-ExpansionEnd   </div><div>      | | | |-ExpansionStart :4:3,</div><div>      | | | |-ExpansionEnd   :4:15,</div><div>
      | | | `-Spelling       :3:19,</div><div>      | | `-Spelling       :2:14,</div><div>      | |-ExpansionEnd   </div><div>      | | |-ExpansionStart </div><div>      | | | |-ExpansionStart :4:3,</div><div>      | | | |-ExpansionEnd   :4:15,</div>
<div>      | | | `-Spelling       :3:16,</div><div>      | | |-ExpansionEnd   </div><div>      | | | |-ExpansionStart :4:3,</div><div>      | | | |-ExpansionEnd   :4:15,</div><div>      | | | `-Spelling       :3:19,</div>
<div>      | | `-Spelling       :2:17,</div><div>      | `-Spelling       :1:14,</div><div>      `-Spelling       </div><div>        |-Expansion      </div><div>        | |-ExpansionStart </div><div>        | | |-ExpansionStart :4:3,</div>
<div>        | | |-ExpansionEnd   :4:15,</div><div>        | | `-Spelling       :3:16,</div><div>        | |-ExpansionEnd   </div><div>        | | |-ExpansionStart :4:3,</div><div>        | | |-ExpansionEnd   :4:15,</div>
<div>        | | `-Spelling       :3:19,</div><div>        | `-Spelling       :2:16,</div><div>        `-Spelling       </div><div>          |-Expansion      </div><div>          | |-ExpansionStart :4:3,</div><div>          | |-ExpansionEnd   :4:15,</div>
<div>          | `-Spelling       :3:18,</div><div>          `-Spelling       </div><div>            |-Expansion      </div><div>            | |-ExpansionStart </div><div>            | | |-ExpansionStart :4:7,</div><div>            | | |-ExpansionEnd   :4:13,</div>
<div>            | | `-Spelling       :2:14,</div><div>            | |-ExpansionEnd   </div><div>            | | |-ExpansionStart :4:7,</div><div>            | | |-ExpansionEnd   :4:13,</div><div>            | | `-Spelling       :2:17,</div>
<div>            | `-Spelling       :1:14,</div><div>            `-Spelling       </div><div>              |-Expansion      </div><div>              | |-ExpansionStart :4:7,</div><div>              | |-ExpansionEnd   :4:13,</div>
<div>              | `-Spelling       :2:16,</div><div>              `-Spelling       </div><div>                |-Expansion      </div><div>                | |-ExpansionStart </div><div>                | | |-ExpansionStart :4:9,</div>
<div>                | | |-ExpansionEnd   :4:12,</div><div>                | | `-Spelling       :2:14,</div><div>                | |-ExpansionEnd   </div><div>                | | |-ExpansionStart :4:9,</div><div>                | | |-ExpansionEnd   :4:12,</div>
<div>                | | `-Spelling       :2:17,</div><div>                | `-Spelling       :1:14,</div><div>                `-Spelling       </div><div>                  |-Expansion      </div><div>                  | |-ExpansionStart :4:9,</div>
<div>                  | |-ExpansionEnd   :4:12,</div><div>                  | `-Spelling       :2:16,</div><div>                  `-Spelling       :4:11</div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, May 8, 2013 at 8:49 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@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"><div class="im">On Wed, May 8, 2013 at 6:42 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br></div><div class="gmail_extra">
<div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div><br><div class="gmail_quote">On Wed, May 8, 2013 at 5:36 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@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>In preparation for some docs on source locations I want to write I came up<br>
with the little helper method that visualizes source locations as a tree.<br>
This is especially helpful when you have many nested levels of macro<br>
expansions.<br>
<br>
Example output:<br>
(SP=(:6:14),<br>
 EX=(SP=(:2:14),<br>
     ES=(:6:8),<br>
     EE=(:6:15)))<br>
<br>
SP = spelling<br>
EX = expansion (if there's only a single location)<br>
ES/EE = expansion start, expansion end (in case there's a range)<br>
<br>
Feel free to bikeshed about the details :D</div></blockquote></div><br></div>Two high-level questions unrelated to the code itself:</div><div class="gmail_extra"><br></div><div class="gmail_extra">1) Should we visualize these trees in roughly the same tree-ish syntax as AST trees? Or is it useful to visualize them on a single line *inside* the AST tree?</div>

</div></blockquote><div><br></div></div><div>I'm all for bike shed color ideas: can you create a paste with how you want it to look? (I tried a few things, and they all looked bad - I'm no good at that :P)</div><div class="im">
<div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">2) Is there a way to make this part of the testing of source locations which is currently done mostly through c-index-test's testing of the writing out of cursor details from libclang?</div>

</div></blockquote><div><br></div></div><div>Not sure - I really want a format that's for users; I'd be happy to create something more machine-readable (JSON for example), so we can use it in tests, though. </div>
<div class="im">
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">One nit-picky detail: please don't use the initialisms.... At least, not *these*. I see SP, EX, and ES in this syntax and I think "wait, is this a stack machine asm chunk?? some other weird assembly language?" before my mind returns to sanity. ;]</div>


</div>
</blockquote></div></div><br></div><div class="gmail_extra">Just tell me what to use :) I don't have strong feelings about anything here - the main problem is that with 4- or 5-layer macros, this can quickly go deep and become unwieldy if names start getting too long (as you know me I of course started with "SpellingLocation" etc :)</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">Cheers,</div><div class="gmail_extra">/Manuel</div></div>
</blockquote></div><br></div>