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}/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{lit_header_restrictions.get(header, '')} 22 23// RUN{BLOCKLIT}: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}} 24// RUN{BLOCKLIT}: %{{cxx}} -c %s -o %t.second.o -DWITH_MAIN %{{flags}} %{{compile_flags}} 25// RUN{BLOCKLIT}: %{{cxx}} -o %t.exe %t.first.o %t.second.o %{{flags}} %{{link_flags}} 26// RUN{BLOCKLIT}: %{{run}} 27 28#include <{header}> 29 30#if defined(WITH_MAIN) 31int main(int, char**) {{ return 0; }} 32#endif 33""") 34