diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy --- a/libcxx/.clang-tidy +++ b/libcxx/.clang-tidy @@ -1,2 +1,2 @@ InheritParentConfig: true -Checks: '-readability-identifier-naming,-llvm-header-guard,-llvm-include-order,-misc-unconventional-assign-operator,-llvm-else-after-return' +Checks: '-readability-identifier-naming,-llvm-header-guard,-misc-unconventional-assign-operator,-llvm-else-after-return' diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/clang_tidy.sh.cpp @@ -0,0 +1,240 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: !has-clang-tidy +// RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* -- %{compile_flags} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-W#warnings" + +//////////////////////////////////////////////////////////////////////////////// +// BEGIN-GENERATED-HEADERS +//////////////////////////////////////////////////////////////////////////////// + +// clang-format off + +// WARNING: This test was generated by generate_header_tests.py +// and should not be edited manually. + +// Top level headers +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_THREADS +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_CXX20_COROUTINES +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# include +#endif +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# include +#endif +#include +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_THREADS +# include +#endif +#include +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_THREADS +# include +#endif +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_THREADS +# include +#endif +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#include +#ifndef _LIBCPP_HAS_NO_INCOMPLETE_RANGES +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_THREADS +# include +#endif +#include +#include +#ifndef _LIBCPP_HAS_NO_THREADS +# include +#endif +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +#endif +#include +#include +#ifndef _LIBCPP_HAS_NO_THREADS +# include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# include +#endif +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# include +#endif + +// experimental headers +#if __cplusplus >= 201103L +# include +# ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES +# include +# endif +# include +# ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include +# endif +# include +# include +# include +# include +# include +# include +# include +# ifndef _LIBCPP_HAS_NO_LOCALIZATION +# include +# endif +# include +# include +# include +# include +# include +# include +# include +# include +#endif // __cplusplus >= 201103L + +// extended headers +#include +#include + +// clang-format on + +//////////////////////////////////////////////////////////////////////////////// +// END-GENERATED-HEADERS +//////////////////////////////////////////////////////////////////////////////// + +#pragma clang diagnostic pop diff --git a/libcxx/utils/generate_header_tests.py b/libcxx/utils/generate_header_tests.py --- a/libcxx/utils/generate_header_tests.py +++ b/libcxx/utils/generate_header_tests.py @@ -206,6 +206,7 @@ produce_test('min_max_macros.compile.pass.cpp', post_include='TEST_MACROS();') produce_test('nasty_macros.compile.pass.cpp') produce_test('no_assert_include.compile.pass.cpp', exclusions=['cassert']) + produce_test('clang_tidy.sh.cpp') if __name__ == '__main__': diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -103,6 +103,9 @@ Feature(name='msvc', when=_isMSVC), Feature(name=lambda cfg: 'msvc-{}'.format(*_msvcVersion(cfg)), when=_isMSVC), Feature(name=lambda cfg: 'msvc-{}.{}'.format(*_msvcVersion(cfg)), when=_isMSVC), + + Feature(name='has-clang-tidy', + when=lambda cfg: runScriptExitCode(cfg, ['clang-tidy --version']) == 0), ] # Deduce and add the test features that that are implied by the #defines in