• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 a TU while using modules.
10# This is important notably because the LLDB data formatters use
11# libc++ headers with modules enabled.
12
13# RUN: %{python} %s %{libcxx}/utils
14
15import sys
16sys.path.append(sys.argv[1])
17from libcxx.header_information import lit_header_restrictions, public_headers
18
19BLOCKLIT = '' # block Lit from interpreting a RUN/XFAIL/etc inside the generation script
20
21for header in public_headers:
22  print(f"""\
23//--- {header}.compile.pass.cpp
24// RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
25
26// GCC doesn't support -fcxx-modules
27// UNSUPPORTED{BLOCKLIT}: gcc
28
29// The Windows headers don't appear to be compatible with modules
30// UNSUPPORTED{BLOCKLIT}: windows
31// UNSUPPORTED{BLOCKLIT}: buildhost=windows
32
33// The AIX headers don't appear to be compatible with modules
34// UNSUPPORTED{BLOCKLIT}: LIBCXX-AIX-FIXME
35
36// The Android headers don't appear to be compatible with modules yet
37// UNSUPPORTED{BLOCKLIT}: LIBCXX-ANDROID-FIXME
38
39// TODO: Investigate this failure
40// UNSUPPORTED{BLOCKLIT}: LIBCXX-FREEBSD-FIXME
41
42// TODO: Investigate this failure
43// UNSUPPORTED{BLOCKLIT}: LIBCXX-PICOLIBC-FIXME
44
45{lit_header_restrictions.get(header, '')}
46
47#include <{header}>
48""")
49
50# TODO: Remove the UNSUPPORTED{BLOCKLIT}: clang-modules-build once issues with this test have been figured out.
51print(f"""\
52//--- __std_clang_module.compile.pass.mm
53// UNSUPPORTED{BLOCKLIT}: clang-modules-build
54
55// RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
56
57// REQUIRES{BLOCKLIT}: clang-modules-build
58
59// GCC doesn't support -fcxx-modules
60// UNSUPPORTED{BLOCKLIT}: gcc
61
62// The Windows headers don't appear to be compatible with modules
63// UNSUPPORTED{BLOCKLIT}: windows
64// UNSUPPORTED{BLOCKLIT}: buildhost=windows
65
66// The AIX headers don't appear to be compatible with modules
67// UNSUPPORTED{BLOCKLIT}: LIBCXX-AIX-FIXME
68
69// The Android headers don't appear to be compatible with modules yet
70// UNSUPPORTED{BLOCKLIT}: LIBCXX-ANDROID-FIXME
71
72// TODO: Investigate this failure
73// UNSUPPORTED{BLOCKLIT}: LIBCXX-FREEBSD-FIXME
74
75@import std;
76
77""")
78