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