Skip to content
Snippets Groups Projects
  1. Sep 06, 2013
    • Daniel Jasper's avatar
      clang-format: Fix regression introduced by r189353. · 2f0a020d
      Daniel Jasper authored
      Before:
        FirstToken->WhitespaceRange.getBegin()
            .getLocWithOffset(First->LastNewlineOffset);
      
      After:
        FirstToken->WhitespaceRange.getBegin().getLocWithOffset(
            First->LastNewlineOffset);
      
      Re-add logic to prevent breaking after an empty set of parentheses.
      Basically it seems that calling a function without parameters is more
      like navigating along the same object than it is a separate step of a
      builder-type call.
      
      We might need to extends this in future to allow "short" parameters that
      e.g. are an index accessing a specific element.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190126 91177308-0d34-0410-b5e6-96231b3b80d8
      2f0a020d
    • Daniel Jasper's avatar
      clang-format: Fix comment formatting bugs in nested blocks. · b77d7416
      Daniel Jasper authored
      This fixes two issues:
      1) The indent of a line comment was not adapted to the subsequent
         statement as it would be outside of a nested block.
      2) A missing DryRun flag caused actualy breaks to be inserted in
         overly long comments while trying to come up with the best line
         breaking decisions.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190123 91177308-0d34-0410-b5e6-96231b3b80d8
      b77d7416
  2. Sep 05, 2013
  3. Sep 04, 2013
  4. Sep 02, 2013
  5. Aug 29, 2013
  6. Aug 28, 2013
    • Daniel Jasper's avatar
      clang-format: Improve token breaking behavior. · f5461785
      Daniel Jasper authored
      Two changes:
      * Don't add an extra penalty on breaking the same token multiple times.
        Generally, we should prefer not to break, but once we break, the
        normal line breaking penalties apply.
      * Slightly increase the penalty for breaking comments. In general, the
        author has put some thought into how to break the comment and we
        should not overwrite this unnecessarily.
      
      With a 40-column column limit, formatting
        aaaaaa("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa");
      
      Leads to:
      Before:
        aaaaaa(
            "aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa "
            "aaaaaaaaaaaaaaaa");
      
      After:
        aaaaaa("aaaaaaaaaaaaaaaa "
               "aaaaaaaaaaaaaaaa "
               "aaaaaaaaaaaaaaaa");
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189466 91177308-0d34-0410-b5e6-96231b3b80d8
      f5461785
  7. Aug 22, 2013
  8. Aug 21, 2013
  9. Aug 20, 2013
  10. Aug 16, 2013
  11. Aug 13, 2013
  12. Aug 12, 2013
  13. Aug 07, 2013
  14. Aug 02, 2013
  15. Aug 01, 2013
  16. Jul 26, 2013
  17. Jul 24, 2013
  18. Jul 17, 2013
  19. Jul 16, 2013
  20. Jul 15, 2013
    • Daniel Jasper's avatar
      Improvement of change r186320. · 9637dda7
      Daniel Jasper authored
      Fixed a test that by now passed for the wrong reason.
      
      Before:
        llvm::outs() << "aaaaaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaa(
                                                       aaaaaaaaaaaaaaaaaaaaaaaaaaaa);
      After:
        llvm::outs() << "aaaaaaaaaaaaaaaaaaa: "
                     << aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa);
      
      Also reformatted Format.cpp with the latest changes (1 formatting fix
      and 1 layout change of a <<-chain).
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186322 91177308-0d34-0410-b5e6-96231b3b80d8
      9637dda7
    • Daniel Jasper's avatar
      Improve formatting of operator<< chains. · 3e12e87f
      Daniel Jasper authored
      Before:
        llvm::outs() << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: "
                     << aaaaaaaaaaaaaaaa << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa;
      
      After:
        llvm::outs() << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa
                     << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa
                     << "aaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaaaaa;
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186320 91177308-0d34-0410-b5e6-96231b3b80d8
      3e12e87f
  21. Jul 12, 2013
    • Daniel Jasper's avatar
      clang-format: Improve <<-formatting. · a0740f5d
      Daniel Jasper authored
      This fixes a regression caused by r186115.
      
      Before:
        Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
             bbbbbbbbb) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                        << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
      
      After:
        Diag(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbb)
            << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186164 91177308-0d34-0410-b5e6-96231b3b80d8
      a0740f5d
    • Daniel Jasper's avatar
      clang-format: Fix string literal breaking. · 0fde9504
      Daniel Jasper authored
      Before this patch, it did not cooperate with
      Style::AlwaysBreakBeforeMultilineStrings. Thus, it would turn
      
        aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");
      
      into:
      
        aaaaaaaaaaaa(aaaaaaaaaaaaa, "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa "
                                    "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");
      
      and only a second format step would lead to the desired (with that
      option):
      
        aaaaaaaaaaaa(aaaaaaaaaaaaa,
                     "aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa "
                     "aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa");
      
      This could even lead to clang-format breaking the string at a different
      character and thus leading to a completely different end result.
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186154 91177308-0d34-0410-b5e6-96231b3b80d8
      0fde9504
    • Daniel Jasper's avatar
      clang-format: Break before/between array subscript expressions. · 011c35da
      Daniel Jasper authored
      clang-format used to treat array subscript expressions much like
      function call (just replacing () with []). However, this is not really
      appropriate especially for expressions with multiple subscripts.
      
      Although it might seem counter-intuitive, the most consistent solution
      seems to be to always (if necessary) break before a square bracket,
      never after it. Also, multiple subscripts of the same expression should
      be aligned if they are on subsequent lines.
      
      Before:
        aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaaaa][
            bbbbbbbbbbbbbbbbbbbbbbbbb] = c;
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[
            aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa][
            bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = ccccccccccc;
      
      After:
        aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaaaa]
                                 [bbbbbbbbbbbbbbbbbbbbbbbbb] = c;
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
            [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]
            [bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = ccccccccccc;
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186153 91177308-0d34-0410-b5e6-96231b3b80d8
      011c35da
  22. Jul 11, 2013
    • Daniel Jasper's avatar
      clang-format: Fix bug concerning the alignment of "}". · 15ec3a87
      Daniel Jasper authored
      Before:
          int i;  // indented 2 space more than clang-format would use.
          SomeReturnType  // clang-format invoked on this line.
          SomeFunctionMakingLBraceEndInColumn80() {
        }  // This is the indent clang-format would prefer.
      
      After:
          int i;  // indented 2 space more than clang-format would use.
          SomeReturnType  // clang-format invoked on this line.
          SomeFunctionMakingLBraceEndInColumn80() {
          }
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186120 91177308-0d34-0410-b5e6-96231b3b80d8
      15ec3a87
    • Daniel Jasper's avatar
      clang-format: Avoid line breaks before the first <<. · faec47bc
      Daniel Jasper authored
      This puts a slight penalty on the linebreak before the first "<<", so
      that clang-format generally tries to keep things on the first line.
      
      User feedback has shown that this is generally desirable.
      
      Before:
        llvm::outs()
            << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =" << aaaaaaaaaaaaaaaaaaaaaaaaaaa;
      
      After:
        llvm::outs() << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ="
                     << aaaaaaaaaaaaaaaaaaaaaaaaaaa;
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186115 91177308-0d34-0410-b5e6-96231b3b80d8
      faec47bc
Loading