[cfe-commits] r171742 - /cfe/trunk/unittests/Format/FormatTest.cpp

Nico Weber thakis at chromium.org
Mon Jan 7 07:50:15 PST 2013


On Mon, Jan 7, 2013 at 7:17 AM, Nico Weber <nicolasweber at gmx.de> wrote:
> Author: nico
> Date: Mon Jan  7 09:17:23 2013
> New Revision: 171742
>
> URL: http://llvm.org/viewvc/llvm-project?rev=171742&view=rev
> Log:
> Add a test that checks that the formatter doesn't discard '@' with ObjC1 set.
>
> Also set ObjC1 in the formatter tests.
>
> The only effect of this flag in the lexer is that '@' now gets turned into
> tok::at instead of tok::unknown.

This isn't quite true, another effect is that OBJC1_AT_KEYWORD from
TokenKinds.def are now active. They are only active after '@' tokens
though, so the general point that this shouldn't affect C++ formatting
is still correct.

>
>
> Modified:
>     cfe/trunk/unittests/Format/FormatTest.cpp
>
> Modified: cfe/trunk/unittests/Format/FormatTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171742&r1=171741&r2=171742&view=diff
> ==============================================================================
> --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
> +++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Jan  7 09:17:23 2013
> @@ -29,6 +29,7 @@
>      LangOptions LangOpts;
>      LangOpts.CPlusPlus = 1;
>      LangOpts.CPlusPlus11 = 1;
> +    LangOpts.ObjC1 = 1;
>      Lexer Lex(ID, Context.Sources.getBuffer(ID), Context.Sources, LangOpts);
>      tooling::Replacements Replace = reformat(Style, Lex, Context.Sources,
>                                               Ranges);
> @@ -1020,5 +1021,10 @@
>            "outRange8:(NSRange) out_range8  outRange9:(NSRange) out_range9;"));
>  }
>
> +TEST_F(FormatTest, DoNotDropAt) {
> +  verifyFormat("@interface");
> +  verifyFormat("@dynamic");
> +}
> +
>  } // end namespace tooling
>  } // end namespace clang
>
>
> _______________________________________________
> 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