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{lit_header_restrictions.get(header, '')} 30{lit_header_undeprecations.get(header, '')} 31 32// TODO: run clang-tidy with modules enabled once they are supported 33// 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 34 35#include <{header}> 36""") 37