1 // RUN: rm -rf %T/misc-header-include-cycle-headers 2 // RUN: mkdir %T/misc-header-include-cycle-headers 3 // RUN: cp -r %S/Inputs/header-include-cycle* %T/misc-header-include-cycle-headers/ 4 // RUN: mkdir %T/misc-header-include-cycle-headers/system 5 // RUN: cp -r %S/Inputs/system/header-include-cycle* %T/misc-header-include-cycle-headers/system 6 // RUN: cp %s %T/header-include-cycle.cpp 7 // RUN: clang-tidy %T%{fs-sep}header-include-cycle.cpp -checks='-*,misc-header-include-cycle' -header-filter=.* \ 8 // RUN: -config="{CheckOptions: {misc-header-include-cycle.IgnoredFilesList: 'header-include-cycle.self-e.hpp'}}" \ 9 // RUN: -- -I%T%{fs-sep}misc-header-include-cycle-headers -isystem %T%{fs-sep}misc-header-include-cycle-headers%{fs-sep}system \ 10 // RUN: --include %T%{fs-sep}misc-header-include-cycle-headers%{fs-sep}header-include-cycle.self-i.hpp | FileCheck %s \ 11 // RUN: -check-prefix=CHECK-MESSAGES "-implicit-check-not={{note|warning|error}}:" --dump-input=fail 12 // RUN: rm -rf %T/misc-header-include-cycle-headers 13 14 #ifndef MAIN_GUARD 15 #define MAIN_GUARD 16 17 #include "header-include-cycle.cpp" 18 // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: direct self-inclusion of header file 'header-include-cycle.cpp' [misc-header-include-cycle] 19 20 #include <header-include-cycle.first-d.hpp> 21 // CHECK-MESSAGES: header-include-cycle.fourth-d.hpp:3:10: warning: circular header file dependency detected while including 'header-include-cycle.first-d.hpp', please check the include path [misc-header-include-cycle] 22 // CHECK-MESSAGES: header-include-cycle.third-d.hpp:3:10: note: 'header-include-cycle.fourth-d.hpp' included from here 23 // CHECK-MESSAGES: header-include-cycle.second-d.hpp:3:10: note: 'header-include-cycle.third-d.hpp' included from here 24 // CHECK-MESSAGES: header-include-cycle.first-d.hpp:3:10: note: 'header-include-cycle.second-d.hpp' included from here 25 // CHECK-MESSAGES: :[[@LINE-5]]:10: note: 'header-include-cycle.first-d.hpp' included from here 26 27 #include <header-include-cycle.first.hpp> 28 // CHECK-MESSAGES: header-include-cycle.fourth.hpp:2:10: warning: circular header file dependency detected while including 'header-include-cycle.first.hpp', please check the include path [misc-header-include-cycle] 29 // CHECK-MESSAGES: header-include-cycle.third.hpp:2:10: note: 'header-include-cycle.fourth.hpp' included from here 30 // CHECK-MESSAGES: header-include-cycle.second.hpp:2:10: note: 'header-include-cycle.third.hpp' included from here 31 // CHECK-MESSAGES: header-include-cycle.first.hpp:2:10: note: 'header-include-cycle.second.hpp' included from here 32 // CHECK-MESSAGES: :[[@LINE-5]]:10: note: 'header-include-cycle.first.hpp' included from here 33 34 #include <header-include-cycle.self-d.hpp> 35 // CHECK-MESSAGES: header-include-cycle.self-d.hpp:3:10: warning: direct self-inclusion of header file 'header-include-cycle.self-d.hpp' [misc-header-include-cycle] 36 37 // CHECK-MESSAGES: header-include-cycle.self-i.hpp:2:10: warning: direct self-inclusion of header file 'header-include-cycle.self-i.hpp' [misc-header-include-cycle] 38 39 #include <header-include-cycle.self-o.hpp> 40 // CHECK-MESSAGES: header-include-cycle.self-n.hpp:2:10: warning: direct self-inclusion of header file 'header-include-cycle.self-n.hpp' [misc-header-include-cycle] 41 42 #include <header-include-cycle.self.hpp> 43 // CHECK-MESSAGES: header-include-cycle.self.hpp:2:10: warning: direct self-inclusion of header file 'header-include-cycle.self.hpp' [misc-header-include-cycle] 44 45 // Should not warn about second include of guarded headers: 46 #include <header-include-cycle.first.hpp> 47 #include <header-include-cycle.first-d.hpp> 48 #include <header-include-cycle.self.hpp> 49 #include <header-include-cycle.self-d.hpp> 50 #include <header-include-cycle.self-o.hpp> 51 #include <header-include-cycle.self-n.hpp> 52 53 // Should not warn about system includes 54 #include <header-include-cycle.first-s.hpp> 55 #include <header-include-cycle.self-s.hpp> 56 57 // Should not warn about this excluded header 58 #include <header-include-cycle.self-e.hpp> 59 #endif 60