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

Nico Weber nicolasweber at gmx.de
Mon Jan 7 07:17:23 PST 2013


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.


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





More information about the cfe-commits mailing list