<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Andrew,</p>
    <p><br>
    </p>
    <p>that at least one possible way :) <br>
    </p>
    <p><br>
    </p>
    <p>clang-tidy has a '<span class="go">-format-style' option that
        will format code after fixing it. You might have a look into
        that for your tool as well.</span></p>
    <p><span class="go"><br>
      </span></p>
    <p><span class="go">All the Best, Jonas<br>
      </span></p>
    <br>
    <div class="moz-cite-prefix">Am 13.12.2017 um 11:21 schrieb Andrew
      Gozillon:<br>
    </div>
    <blockquote type="cite"
cite="mid:AM6PR0102MB3173B959512DD6C66B8451A7BF350@AM6PR0102MB3173.eurprd01.prod.exchangelabs.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
        dir="ltr">
        <p style="margin-top:0;margin-bottom:0">Hi Jonas,</p>
        <p style="margin-top:0;margin-bottom:0"><br>
        </p>
        <p style="margin-top:0;margin-bottom:0">Thank you very much, I
          was wondering if that was the right way to go about it. </p>
        <p style="margin-top:0;margin-bottom:0"><br>
        </p>
        <p style="margin-top:0;margin-bottom:0">Best Regards,</p>
        <p style="margin-top:0;margin-bottom:0">Andrew</p>
        <p style="margin-top:0;margin-bottom:0"><br>
        </p>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b> Jonas
          Toth <a class="moz-txt-link-rfc2396E" href="mailto:jonas.toth@gmail.com"><jonas.toth@gmail.com></a><br>
          <b>Sent:</b> 13 December 2017 08:03:43<br>
          <b>To:</b> Andrew Gozillon<br>
          <b>Cc:</b> via cfe-dev<br>
          <b>Subject:</b> Re: [cfe-dev] Question about Clang Rewriter
          and white space</font>
        <div> </div>
      </div>
      <div>
        <div dir="auto">Hi Andrew,
          <div dir="auto"><br>
          </div>
          <div dir="auto">white space is a job for clang-format. You can
            do your rewriting and apply it afterwards to get nice
            looking code.</div>
        </div>
        <div class="x_gmail_extra"><br>
          <div class="x_gmail_quote">Am 13.12.2017 6:32 vorm. schrieb
            "Andrew Gozillon via cfe-dev" <<a
              href="mailto:cfe-dev@lists.llvm.org"
              moz-do-not-send="true">cfe-dev@lists.llvm.org</a>>:<br
              type="attribution">
            <blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex;
              border-left:1px #ccc solid; padding-left:1ex">
              <div dir="ltr">
                <div id="x_m_-2833966386067616039divtagdefaultwrapper"
                  dir="ltr" style="font-size:12pt; color:#000000;
                  font-family:Calibri,Helvetica,sans-serif">
                  <p style="margin-top:0; margin-bottom:0">Hi,</p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">I am
                    currently playing around with a Clang Libtool and I
                    was wondering if there was a way to make the Clang
                    Rewriter remove white space or if there is another
                    utility class that can do this? For example I have
                    an arbitrary set of template parameters:</p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">template
                    <typename X, typename Y></p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">And I wish to
                    remove the first template parameter using the
                    Rewriter in this case to modify the source code. To
                    do this I remove the typename X and the comma.
                    However, the result ends up like:</p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">template <
                    typename Y></p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">Which
                    contains some unsightly white space! This persists
                    even if I increase the SourceRange to just before
                    the t of typename Y. So it seems to be ignoring the
                    space.</p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">So in essence
                    is there a way to make the Rewriter consider white
                    space for removal or is there an alternative tool or
                    method (like using a function of Clangs AST) to
                    avoid this? At the moment I work around this by
                    injecting an arbitrary character in the empty space
                    and then I delete it. Which works, but doesn't seem
                    like the ideal solution. </p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">Sorry if this
                    is a silly question and t<span
                      style="font-size:12pt">hank you very much for
                      everyone's time. </span></p>
                  <p style="margin-top:0; margin-bottom:0"><br>
                  </p>
                  <p style="margin-top:0; margin-bottom:0">Best Regards,</p>
                  <p style="margin-top:0; margin-bottom:0">Andrew  </p>
                </div>
              </div>
              <br>
              ______________________________<wbr>_________________<br>
              cfe-dev mailing list<br>
              <a href="mailto:cfe-dev@lists.llvm.org"
                moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
              <a
                href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
                rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
              <br>
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>