]> granicus.if.org Git - clang/commitdiff
clang-format: Support #include_next
authorDaniel Jasper <djasper@google.com>
Tue, 19 May 2015 11:22:29 +0000 (11:22 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 19 May 2015 11:22:29 +0000 (11:22 +0000)
Before:
  #include_next < test.h >

After:
  #include_next <test.h>

This fixes llvm.org/PR23500

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237686 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp

index 772fa1d2390589892d7749c6a74081017781cbb0..8088ff667e1fdde216763587d2ec12e71f07eb94 100644 (file)
@@ -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();
index 9c3448ad83b11eed33634a696689334656d5dde7..d035043b0fe1a0e1472b465ccdff26dbc3c07ffa 100644 (file)
@@ -5987,6 +5987,7 @@ TEST_F(FormatTest, HandlesIncludeDirectives) {
                "#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\"",