44 lines · python
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-exception6#7# ===----------------------------------------------------------------------===##8 9# Test that we can include each header in two TU's and link them together.10 11# We're using compiler-specific flags in this test12# REQUIRES: (gcc || clang)13 14# RUN: %{python} %s %{libcxx-dir}/utils15# END.16 17import sys18sys.path.append(sys.argv[1])19from libcxx.header_information import (20 lit_header_restrictions,21 lit_header_undeprecations,22 public_headers,23)24 25for header in public_headers:26 print(27 f"""\28//--- {header}.sh.cpp29{lit_header_restrictions.get(header, '')}30{lit_header_undeprecations.get(header, '')}31 32// RUN: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}}33// RUN: %{{cxx}} -c %s -o %t.second.o -DWITH_MAIN %{{flags}} %{{compile_flags}}34// RUN: %{{cxx}} -o %t.exe %t.first.o %t.second.o %{{flags}} %{{link_flags}}35// RUN: %{{run}}36 37#include <{header}>38 39#if defined(WITH_MAIN)40int main(int, char**) {{ return 0; }}41#endif42"""43 )44