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# Test that we can include each header in two TU's and link them together. 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 ( 19 lit_header_restrictions, 20 lit_header_undeprecations, 21 public_headers, 22) 23 24for header in public_headers: 25 print( 26 f"""\ 27//--- {header}.sh.cpp 28{lit_header_restrictions.get(header, '')} 29{lit_header_undeprecations.get(header, '')} 30 31// RUN: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}} 32// RUN: %{{cxx}} -c %s -o %t.second.o -DWITH_MAIN %{{flags}} %{{compile_flags}} 33// RUN: %{{cxx}} -o %t.exe %t.first.o %t.second.o %{{flags}} %{{link_flags}} 34// RUN: %{{run}} 35 36#include <{header}> 37 38#if defined(WITH_MAIN) 39int main(int, char**) {{ return 0; }} 40#endif 41""" 42 ) 43