I have been working on a source-to-source translator using Clang. I have created a Clang plugin with my own ASTConsumer that mainly uses the Rewriter class for performing code transformations. Just had a quick question.<br>
<br>I am trying to insert some code at the top of the main method, before any other statements. To do this I start by getting the location of the left brace using CompoundStmts getLBracLoc method. This works fine, but when I then try to insert text after that location with Rewriter's InsertTextAfter, it inserts it <i>before</i> the brace. Is this an expected behavior? If so, any recommendations on how to accomplish what I'm trying to do?<br>
<br><br>Thanks!<br>Gabriel<br>