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}/utils 12 13import sys 14sys.path.append(sys.argv[1]) 15from libcxx.header_information import lit_header_restrictions, public_headers 16 17for header in public_headers: 18 BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script 19 print(f"""\ 20//--- {header}.sh.cpp 21 22// REQUIRES{BLOCKLIT}: has-clang-tidy 23 24// The GCC compiler flags are not always compatible with clang-tidy. 25// UNSUPPORTED{BLOCKLIT}: gcc 26 27{lit_header_restrictions.get(header, '')} 28 29// TODO: run clang-tidy with modules enabled once they are supported 30// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules 31// RUN{BLOCKLIT}: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx}}/.clang-tidy -- -Wweak-vtables %{{compile_flags}} -fno-modules 32 33#include <{header}> 34""") 35