r196080 - clang-format: Fix excessive formatting caused by r195954.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Dec 2 06:25:04 PST 2013


Thanks!

On 2 December 2013 04:19, Daniel Jasper <djasper at google.com> wrote:
> Author: djasper
> Date: Mon Dec  2 03:19:27 2013
> New Revision: 196080
>
> URL: http://llvm.org/viewvc/llvm-project?rev=196080&view=rev
> Log:
> clang-format: Fix excessive formatting caused by r195954.
>
> Due to a bug in the patch, clang-format would more or less simply format
> all multi-line comments.
>
> Modified:
>     cfe/trunk/lib/Format/Format.cpp
>     cfe/trunk/unittests/Format/FormatTest.cpp
>
> Modified: cfe/trunk/lib/Format/Format.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=196080&r1=196079&r2=196080&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Format/Format.cpp (original)
> +++ cfe/trunk/lib/Format/Format.cpp Mon Dec  2 03:19:27 2013
> @@ -1457,6 +1457,7 @@ private:
>      bool IsContinuedComment = Line->First->is(tok::comment) &&
>                                Line->First->Next == NULL &&
>                                Line->First->NewlinesBefore < 2 && PreviousLine &&
> +                              PreviousLine->Affected &&
>                                PreviousLine->Last->is(tok::comment);
>
>      if (SomeTokenAffected || SomeFirstChildAffected || LineMoved ||
>
> Modified: cfe/trunk/unittests/Format/FormatTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=196080&r1=196079&r2=196080&view=diff
> ==============================================================================
> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
> +++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Dec  2 03:19:27 2013
> @@ -859,6 +859,13 @@ TEST_F(FormatTest, CanFormatCommentsLoca
>                     "\n"
>                     "  // This is unrelated",
>                     0, 0, getLLVMStyle()));
> +  EXPECT_EQ("int a;\n"
> +            "// This is\n"
> +            "// not formatted.   ",
> +            format("int a;\n"
> +                   "// This is\n"
> +                   "// not formatted.   ",
> +                   0, 0, getLLVMStyle()));
>  }
>
>  TEST_F(FormatTest, RemovesTrailingWhitespaceOfComments) {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list