r225965 - clang-format: [Java] Understand "import static".

Daniel Jasper djasper at google.com
Wed Jan 14 02:02:49 PST 2015


Author: djasper
Date: Wed Jan 14 04:02:49 2015
New Revision: 225965

URL: http://llvm.org/viewvc/llvm-project?rev=225965&view=rev
Log:
clang-format: [Java] Understand "import static".

Modified:
    cfe/trunk/lib/Format/TokenAnnotator.cpp
    cfe/trunk/unittests/Format/FormatTestJava.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=225965&r1=225964&r2=225965&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Wed Jan 14 04:02:49 2015
@@ -621,7 +621,8 @@ public:
          CurrentToken->is(Keywords.kw_package)) ||
         (Info && Info->getPPKeywordID() == tok::pp_import &&
          CurrentToken->Next &&
-         CurrentToken->Next->isOneOf(tok::string_literal, tok::identifier))) {
+         CurrentToken->Next->isOneOf(tok::string_literal, tok::identifier,
+                                     tok::kw_static))) {
       next();
       parseIncludeDirective();
       return LT_ImportStatement;

Modified: cfe/trunk/unittests/Format/FormatTestJava.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJava.cpp?rev=225965&r1=225964&r2=225965&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJava.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJava.cpp Wed Jan 14 04:02:49 2015
@@ -369,6 +369,8 @@ TEST_F(FormatTestJava, PackageDeclaratio
 TEST_F(FormatTestJava, ImportDeclarations) {
   verifyFormat("import some.really.loooooooooooooooooooooong.imported.Class;",
                getStyleWithColumns(50));
+  verifyFormat("import static some.really.looooooooooooooooong.imported.Class;",
+               getStyleWithColumns(50));
 }
 
 TEST_F(FormatTestJava, MethodDeclarations) {





More information about the cfe-commits mailing list