47 lines · cpp
1// RUN: %check_clang_tidy %s llvm-include-order %t -- -- -isystem %clang_tidy_headers2 3// CHECK-MESSAGES: [[@LINE+2]]:1: warning: #includes are not sorted properly4#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" // hi13#include "llvm-c/d.h" // -c14 15// CHECK-FIXES: #include "j.h"16// CHECK-FIXES-NEXT: #include "i.h"17// CHECK-FIXES-NEXT: #include "clang-c/c.h" // hi18// CHECK-FIXES-NEXT: #include "clang/b.h"19// CHECK-FIXES-NEXT: #include "llvm-c/d.h" // -c20// 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 FOO28#include "a.h"29#endif30 31// CHECK-FIXES: #include "b.h"32// CHECK-FIXES-NEXT: #ifdef FOO33// CHECK-FIXES-NEXT: #include "a.h"34// CHECK-FIXES-NEXT: #endif35 36// CHECK-MESSAGES: [[@LINE+1]]:1: warning: #includes are not sorted properly37#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 properly44#include "cross-file-c.h"45// This line number should correspond to the position of the #include in cross-file-c.h46#include "cross-file-a.h"47