aboutsummaryrefslogtreecommitdiff
path: root/libcxx/test/libcxx-03/clang_tidy.gen.py
blob: 5926f521e780eb65ad7095bda82debc59765ff38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ===----------------------------------------------------------------------===##
#
# 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
#
# ===----------------------------------------------------------------------===##

# Run our custom libc++ clang-tidy checks on all public headers.

# REQUIRES: has-clang-tidy

# The frozen headers should not be updated to the latest libc++ style, so don't test.
# UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME

# The GCC compiler flags are not always compatible with clang-tidy.
# UNSUPPORTED: gcc

# RUN: %{python} %s %{libcxx-dir}/utils
# END.

import sys
sys.path.append(sys.argv[1])
from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers

for header in public_headers:
  print(f"""\
//--- {header}.sh.cpp
{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}

// TODO: run clang-tidy with modules enabled once they are supported
// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx-dir}}/.clang-tidy --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- -Wweak-vtables %{{compile_flags}} -fno-modules

#include <{header}>
""")