1 // RUN: %check_clang_tidy %s llvm-include-order %t -- -- -isystem %S/Inputs/Headers 2 3 // CHECK-MESSAGES: [[@LINE+2]]:1: warning: #includes are not sorted properly 4 #include "j.h" 5 #include "gtest/foo.h" 6 #include "gmock/foo.h" 7 #include "i.h" 8 #include <s.h> 9 #include "llvm/a.h" 10 #include "clang/b.h" 11 #include "clang-c/c.h" // hi 12 #include "llvm-c/d.h" // -c 13 14 // CHECK-FIXES: #include "j.h" 15 // CHECK-FIXES-NEXT: #include "i.h" 16 // CHECK-FIXES-NEXT: #include "clang-c/c.h" // hi 17 // CHECK-FIXES-NEXT: #include "clang/b.h" 18 // CHECK-FIXES-NEXT: #include "llvm-c/d.h" // -c 19 // CHECK-FIXES-NEXT: #include "llvm/a.h" 20 // CHECK-FIXES-NEXT: #include "gmock/foo.h" 21 // CHECK-FIXES-NEXT: #include "gtest/foo.h" 22 // CHECK-FIXES-NEXT: #include <s.h> 23 24 #include "b.h" 25 #ifdef FOO 26 #include "a.h" 27 #endif 28 29 // CHECK-FIXES: #include "b.h" 30 // CHECK-FIXES-NEXT: #ifdef FOO 31 // CHECK-FIXES-NEXT: #include "a.h" 32 // CHECK-FIXES-NEXT: #endif 33 34 // CHECK-MESSAGES: [[@LINE+1]]:1: warning: #includes are not sorted properly 35 #include "b.h" 36 #include "a.h" 37 38 // CHECK-FIXES: #include "a.h" 39 // CHECK-FIXES-NEXT: #include "b.h" 40 41 // CHECK-MESSAGES-NOT: [[@LINE+1]]:1: warning: #includes are not sorted properly 42 #include "cross-file-c.h" 43 // This line number should correspond to the position of the #include in cross-file-c.h 44 #include "cross-file-a.h" 45