1// RUN: %check_clang_tidy %s misc-include-cleaner %t -- -- -I%S/Inputs -isystem%S/Inputs/system
2#include "bar.h"
3// CHECK-FIXES: {{^}}#include "baz.h"{{$}}
4#include "foo.h"
5// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: included header foo.h is not used directly [misc-include-cleaner]
6// CHECK-FIXES: {{^}}
7// CHECK-FIXES: {{^}}#include <string>{{$}}
8#include <vector.h>
9// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: included header vector.h is not used directly [misc-include-cleaner]
10// CHECK-FIXES: {{^}}
11int BarResult = bar();
12int BazResult = baz();
13// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: no header providing "baz" is directly included [misc-include-cleaner]
14std::string HelloString;
15// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: no header providing "std::string" is directly included [misc-include-cleaner]
16int FooBarResult = foobar();
17// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: no header providing "foobar" is directly included [misc-include-cleaner]
18

source code of clang-tools-extra/test/clang-tidy/checkers/misc/include-cleaner.cpp