[PATCH] Add debug method to visualize complex source locations

Chandler Carruth chandlerc at google.com
Wed May 8 09:42:42 PDT 2013


On Wed, May 8, 2013 at 5:36 PM, Manuel Klimek <klimek at google.com> wrote:

> In preparation for some docs on source locations I want to write I came up
> with the little helper method that visualizes source locations as a tree.
> This is especially helpful when you have many nested levels of macro
> expansions.
>
> Example output:
> (SP=(:6:14),
>  EX=(SP=(:2:14),
>      ES=(:6:8),
>      EE=(:6:15)))
>
> SP = spelling
> EX = expansion (if there's only a single location)
> ES/EE = expansion start, expansion end (in case there's a range)
>
> Feel free to bikeshed about the details :D
>

Two high-level questions unrelated to the code itself:

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?

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?

u
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. ;]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130508/4fc0c93e/attachment.html>


More information about the cfe-commits mailing list