r273694 - clang-format: [JS] Fix build breakage.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 14:43:41 PDT 2016


The patch description seems wrong as this doesn't fix a build breakage
AFAICT. Do you mean a test failure? If so, it would be helpful to #include
what's actually changing (before/after or calling out the failing test case
or something).


On Fri, Jun 24, 2016 at 7:45 PM, Martin Probst via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: mprobst
> Date: Fri Jun 24 12:45:13 2016
> New Revision: 273694
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273694&view=rev
> Log:
> clang-format: [JS] Fix build breakage.
>
> Checking Line.MustBeDeclaration does actually break the field and param
> initializer use case.
>
> Modified:
>     cfe/trunk/lib/Format/TokenAnnotator.cpp
>     cfe/trunk/unittests/Format/FormatTestJS.cpp
>
> Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=273694&r1=273693&r2=273694&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Jun 24 12:45:13 2016
> @@ -639,7 +639,7 @@ private:
>        }
>        // Declarations cannot be conditional expressions, this can only be
> part
>        // of a type declaration.
> -      if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
> +      if (!Contexts.back().IsExpression &&
>            Style.Language == FormatStyle::LK_JavaScript)
>          break;
>        parseConditional();
>
> Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=273694&r1=273693&r2=273694&view=diff
>
> ==============================================================================
> --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
> +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Jun 24 12:45:13 2016
> @@ -1351,7 +1351,7 @@ TEST_F(FormatTestJS, NonNullAssertionOpe
>
>  TEST_F(FormatTestJS, Conditional) {
>    verifyFormat("y = x ? 1 : 2;");
> -  verifyFormat("x ? 1 : 2;");
> +  verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals.
>    verifyFormat("class Foo {\n"
>                 "  field = true ? 1 : 2;\n"
>                 "  method(a = true ? 1 : 2) {}\n"
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160624/17e2de27/attachment.html>


More information about the cfe-commits mailing list