1// RUN: rm -rf %T/Headers
2// RUN: mkdir %T/Headers
3// RUN: cp -r %S/Inputs/restrict-system-includes %T/Headers/portability-restrict-system-includes
4// RUN: %check_clang_tidy -std=c++11 %s portability-restrict-system-includes %t \
5// RUN: -- -config="{CheckOptions: {portability-restrict-system-includes.Includes: 'transitive.h,s.h'}}" \
6// RUN: -system-headers -header-filter=.* \
7// RUN: -- -I %T/Headers/portability-restrict-system-includes -isystem %T/Headers/portability-restrict-system-includes/system
8// RUN: FileCheck -input-file=%T/Headers/portability-restrict-system-includes/transitive2.h %s -check-prefix=CHECK-FIXES
9// RUN: rm -rf %T/Headers
10// FIXME: Make the test work in all language modes.
11
12// transitive.h includes <r.h> and <t.h>
13#include <transitive.h>
14// CHECK-MESSAGES: :1:1: warning: system include r.h not allowed, transitively included from {{.*}}
15// CHECK-MESSAGES: :2:1: warning: system include t.h not allowed, transitively included from {{.*}}
16
17// transitive.h includes <s.h> and <t.h>
18#include "transitive2.h"
19// CHECK-MESSAGES: :2:1: warning: system include t.h not allowed, transitively included from {{.*}}
20// CHECK-FIXES-NOT: #include <t.h>
21
22int main() {
23 // f() is declared in r.h
24}
25

source code of clang-tools-extra/test/clang-tidy/checkers/portability/restrict-system-includes-transitive.cpp