r237686 - clang-format: Support #include_next

Daniel Jasper djasper at google.com
Tue May 19 04:22:29 PDT 2015


Author: djasper
Date: Tue May 19 06:22:29 2015
New Revision: 237686

URL: http://llvm.org/viewvc/llvm-project?rev=237686&view=rev
Log:
clang-format: Support #include_next

Before:
  #include_next < test.h >

After:
  #include_next <test.h>

This fixes llvm.org/PR23500

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

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=237686&r1=237685&r2=237686&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue May 19 06:22:29 2015
@@ -633,6 +633,7 @@ private:
       return Type;
     switch (CurrentToken->Tok.getIdentifierInfo()->getPPKeywordID()) {
     case tok::pp_include:
+    case tok::pp_include_next:
     case tok::pp_import:
       next();
       parseIncludeDirective();

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=237686&r1=237685&r2=237686&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue May 19 06:22:29 2015
@@ -5987,6 +5987,7 @@ TEST_F(FormatTest, HandlesIncludeDirecti
                "#include \"string.h\"\n"
                "#include <a-a>\n"
                "#include < path with space >\n"
+               "#include_next <test.h>"
                "#include \"abc.h\" // this is included for ABC\n"
                "#include \"some long include\" // with a comment\n"
                "#include \"some very long include paaaaaaaaaaaaaaaaaaaaaaath\"",





More information about the cfe-commits mailing list