<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 02/12/2013 09:24, Daniel Jasper
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAK_tg0wpD7RCEoRcBqH8TJUw9PGkngyHj+3xxH9S+mSGMc3BCA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Fixed in r196080.</div>
    </blockquote>
    <br>
    Thanks!<br>
    <br>
    This avoids unrelated whitespace edits following the change but
    there's still a problem with preceding unrelated lines getting
    modified. Not sure if this is a regression or pre-existing problem.<br>
    <br>
    With the attached format.cpp input, requesting formatting of line
    range 3 causes lines 1 and 2 to get edited:<br>
    <br>
    <code>clang-format -lines=3:3 format.cpp | diff -U format.cpp -</code><code><br>
    </code><code>Can't find usable .clang-format, using LLVM style</code><code><br>
    </code><code>--- format.cpp    2013-12-05 09:51:34.000000000 +0000</code><code><br>
    </code><code>+++ -    2013-12-05 09:52:43.000000000 +0000</code><code><br>
    </code><code>@@ -1,5 +1,5 @@</code><code><br>
    </code><code>-void f() {  </code><code><br>
    </code><code>-  </code><code><br>
    </code><code>+void f() {</code><code><br>
    </code><code>+</code><code><br>
    </code><code>   // Get the solitary sucessor.</code><code><br>
    </code><code>   const CFGBlock *Succ = *(Entry->succ_begin());</code><code><br>
    </code><code> }</code><br>
    <br>
    AFAICT the problem only exists with comment lines. Requesting line 4
    doesn't trigger it. Noticed while preparing the comment typo fix
    patches.<br>
    <br>
    Alp.<br>
    <br>
    <br>
    <blockquote
cite="mid:CAK_tg0wpD7RCEoRcBqH8TJUw9PGkngyHj+3xxH9S+mSGMc3BCA@mail.gmail.com"
      type="cite">
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Mon, Dec 2, 2013 at 9:52 AM, Alp
          Toker <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div class="im"> <br>
                <div>On 02/12/2013 08:24, Daniel Jasper wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">I just tried reproducing this and it
                    still works fine here (both in vim and in emacs).
                    Are you sure that clang-format removes that trailing
                    whitespace?</div>
                </blockquote>
                <br>
              </div>
              Hi Daniel,<br>
              <br>
              I think Rafael is onto something.<br>
              <br>
              If you take a look at r196038 in clang-tools-extra,
              there's an unrelated whitespace fix that slipped into the
              commit yesterday:<br>
              <br>
              <br>
              <code>@@ -262,7 +262,7 @@ StatementMatcher
                makePseudoArrayLoopMatcher() {</code><code><br>
              </code><code>   // Test that the incoming type has a
                record declaration that has methods</code><code><br>
              </code><code>   // called 'begin' and 'end'. If the
                incoming type is const, then make sure</code><code><br>
              </code><code>   // these methods are also marked const.</code><code><br>
              </code><code>-  // </code><code><br>
              </code><code>+  //</code><code><br>
              </code><code>   // FIXME: To be completely thorough this
                matcher should also ensure the</code><code><br>
              </code><code>   // return type of begin/end is an iterator
                that dereferences to the same as</code><code><br>
              </code><code>   // what operator[] or at() returns. Such a
                test isn't likely to fail except</code><br>
              <br>
              The line that was legitimately changed is a fair bit above
              so I wouldn't have expected to see this edit to an
              untouched line.<br>
              <br>
              I can try re-creating the patch as it was before running
              clang-format if it'd be any help.<br>
              <br>
              diff -U0 | clang-format-diff.py -p1 -i<br>
              <br>
              Alp.<br>
              <br>
              <br>
              <blockquote type="cite">
                <div class="im">
                  <div class="gmail_extra"><br>
                    <br>
                    <div class="gmail_quote"> On Sun, Dec 1, 2013 at
                      7:01 PM, Rafael Espíndola <span dir="ltr"><<a
                          moz-do-not-send="true"
                          href="mailto:rafael.espindola@gmail.com"
                          target="_blank">rafael.espindola@gmail.com</a>></span>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex"> This seems to have
                        caused a regression with at least the emacs<br>
                        integration. Running clang-format-region now
                        seems to remove trailing<br>
                        white space from unrelated areas. For example,
                        run it with the cursor<br>
                        in Sema.cpp:1112:<br>
                        <br>
                          if (!LangOpts.RetainCommentsFromSystemHeaders
                        &&<br>
                        <br>
                        and the trailing white space in Sema.cpp:1100:<br>
                        <br>
                        // We have a generic lambda if we parsed auto
                        parameters, or we have<br>
                        <br>
                        is removed.<br>
                        <br>
                        Cheers,<br>
                        Rafael<br>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                  <br>
                  <fieldset></fieldset>
                  <br>
                </div>
                <div class="im">
                  <pre>_______________________________________________
cfe-commits mailing list
<a moz-do-not-send="true" href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a>
<a moz-do-not-send="true" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a>
</pre>
                </div>
              </blockquote>
              <span class="HOEnZb"><font color="#888888"> <br>
                  <pre cols="72">-- 
<a moz-do-not-send="true" href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a>
the browser experts
</pre>
                </font></span></div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.nuanti.com">http://www.nuanti.com</a>
the browser experts
</pre>
  </body>
</html>