// Copy the 'mylib.h' to a directory under the build directory. This is // required, since the relative order of the emitted diagnostics depends on the // absolute file paths which is sorted by clang-tidy prior emitting. // // RUN: mkdir -p %t/sys && mkdir -p %t/usr \ // RUN: && cp %S/Inputs/deprecated-headers/mysystemlib.h %t/sys/mysystemlib.h \ // RUN: && cp %S/Inputs/deprecated-headers/mylib.h %t/usr/mylib.h // RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \ // RUN: -check-suffixes=DEFAULT \ // RUN: --header-filter='.*' --system-headers \ // RUN: -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/deprecated-headers // RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \ // RUN: -check-suffixes=DEFAULT,CHECK-HEADER-FILE \ // RUN: -config="{CheckOptions: {modernize-deprecated-headers.CheckHeaderFile: 'true'}}" \ // RUN: --header-filter='.*' --system-headers \ // RUN: -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/deprecated-headers // REQUIRES: system-linux #define EXTERN_C extern "C" extern "C++" { // We should still have the warnings here. #include // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers] } #include // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] #include // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers] #include // no-warning: Don't warn into system headers. #include // CHECK-MESSAGES-CHECK-HEADER-FILE: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] namespace wrapping { extern "C" { #include // no-warning #include // no-warning #include // no-warning } } // namespace wrapping extern "C" { namespace wrapped { #include // no-warning #include // no-warning #include // no-warning } // namespace wrapped } namespace wrapping { extern "C" { namespace wrapped { #include // no-warning #include // no-warning #include // no-warning } // namespace wrapped } } // namespace wrapping EXTERN_C { #include // no-warning #include // no-warning #include // no-warning }