[cfe-dev] LibFormat usage question

Jesper Eskilson Jesper.Eskilson at iar.com
Thu Oct 31 11:34:44 PDT 2013


On 2013-10-31 17:59, David Blaikie wrote:
>
>
>
> On Thu, Oct 31, 2013 at 6:32 AM, Jesper Eskilson
> <Jesper.Eskilson at iar.com <mailto:Jesper.Eskilson at iar.com>> wrote:
>
>
>     Hi,
>
>     I'm trying to figure out how to programmatically invoke clang-format
>     to format code. I would like to get from a declaration ("Decl *") to
>     a plain string containing the reformatted source code.
>
>
> It's generally advised that one should not attempt to round trip source
> code through the AST. Use the AST to inform mutations of the original
> source (by using source locations to identify pieces to move, insert, or
> remove), rather than to produce new source from the parsed AST.
>

Ok, so how do I do that? I'm afraid that I'm too new to Clang to 
understand how things fit together here.

/Jesper
-- 
*Jesper Eskilson* /Development Engineer/
IAR Systems AB
Box 23051, Strandbodgatan 1
SE-750 23 Uppsala, SWEDEN
E-mail: jesper.eskilson at iar.com <mailto:jesper.eskilson at iar.com>
Website: www.iar.com
<http://www.iar.com> Twitter: www.twitter.com/iarsystems
<http://www.twitter.com/iarsystems>



More information about the cfe-dev mailing list