• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ===----------------------------------------------------------------------===##
2#
3# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4# See https://llvm.org/LICENSE.txt for license information.
5# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6#
7# ===----------------------------------------------------------------------===##
8
9# Run our custom libc++ clang-tidy checks on all public headers.
10
11# RUN: %{python} %s %{libcxx-dir}/utils
12
13# block Lit from interpreting a RUN/XFAIL/etc inside the generation script
14# END.
15
16import sys
17sys.path.append(sys.argv[1])
18from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
19
20for header in public_headers:
21  print(f"""\
22//--- {header}.sh.cpp
23
24// REQUIRES: has-clang-tidy
25
26// The GCC compiler flags are not always compatible with clang-tidy.
27// UNSUPPORTED: gcc
28
29// Clang 17 has false positives.
30// UNSUPPORTED: clang-17
31
32{lit_header_restrictions.get(header, '')}
33{lit_header_undeprecations.get(header, '')}
34
35// TODO: run clang-tidy with modules enabled once they are supported
36// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules
37// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx-dir}}/.clang-tidy -- -Wweak-vtables %{{compile_flags}} -fno-modules
38
39#include <{header}>
40""")
41