mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-10-07 10:54:01 +00:00
[libc++][Modules] Recreate the top level std
clang module
lldb needs the `std` clang module to make all of libc++ available in the debugger. Make a new header to include the rest of the public headers and use to build a `std` module that just re-exports the rest of libc++. Reviewed By: Mordante, JDevlieghere, #libc Differential Revision: https://reviews.llvm.org/D156177
This commit is contained in:
parent
6a8b66ec19
commit
a800485a2d
@ -653,6 +653,7 @@ set(files
|
||||
__ranges/views.h
|
||||
__ranges/zip_view.h
|
||||
__split_buffer
|
||||
__std_clang_module
|
||||
__std_mbstate_t.h
|
||||
__stop_token/atomic_unique_lock.h
|
||||
__stop_token/intrusive_list_view.h
|
||||
|
212
libcxx/include/__std_clang_module
Normal file
212
libcxx/include/__std_clang_module
Normal file
@ -0,0 +1,212 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// This header should not be directly included, it's exclusively to import all
|
||||
// of the libc++ public clang modules for the `std` clang module to export. In
|
||||
// other words, it's to facilitate `@import std;` in Objective-C++ and `import std`
|
||||
// in Swift to expose all of the libc++ interfaces. This is generally not
|
||||
// recommended, however there are some clients that need to import all of libc++
|
||||
// without knowing what "all" is.
|
||||
#if !__building_module(std)
|
||||
# error "Do not include this header directly, include individual headers instead"
|
||||
#endif
|
||||
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <any>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <bit>
|
||||
#include <bitset>
|
||||
#include <charconv>
|
||||
#include <chrono>
|
||||
#include <compare>
|
||||
#include <complex>
|
||||
#include <concepts>
|
||||
#include <condition_variable>
|
||||
#include <deque>
|
||||
#include <exception>
|
||||
#include <execution>
|
||||
#include <expected>
|
||||
#include <format>
|
||||
#include <forward_list>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <iosfwd>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <mdspan>
|
||||
#include <memory>
|
||||
#include <memory_resource>
|
||||
#include <new>
|
||||
#include <numbers>
|
||||
#include <numeric>
|
||||
#include <optional>
|
||||
#include <queue>
|
||||
#include <random>
|
||||
#include <ranges>
|
||||
#include <ratio>
|
||||
#include <scoped_allocator>
|
||||
#include <set>
|
||||
#include <source_location>
|
||||
#include <span>
|
||||
#include <stack>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <system_error>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <typeindex>
|
||||
#include <typeinfo>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <valarray>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <version>
|
||||
|
||||
#include <cassert>
|
||||
#include <ccomplex>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cfenv>
|
||||
#include <cfloat>
|
||||
#include <cinttypes>
|
||||
#include <ciso646>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <csetjmp>
|
||||
#include <csignal>
|
||||
#include <cstdarg>
|
||||
#include <cstdbool>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctgmath>
|
||||
#include <ctime>
|
||||
#include <cuchar>
|
||||
|
||||
#include <complex.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fenv.h>
|
||||
#include <float.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <tgmath.h>
|
||||
#include <uchar.h>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
|
||||
# include <codecvt>
|
||||
# ifndef _LIBCPP_HAS_NO_FILESYSTEM
|
||||
# include <fstream>
|
||||
# endif
|
||||
# include <iomanip>
|
||||
# include <ios>
|
||||
# include <iostream>
|
||||
# include <istream>
|
||||
# include <locale>
|
||||
# include <ostream>
|
||||
# include <regex>
|
||||
# include <sstream>
|
||||
# include <streambuf>
|
||||
# include <strstream>
|
||||
|
||||
# include <clocale>
|
||||
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
|
||||
# include <cwchar>
|
||||
# include <cwctype>
|
||||
|
||||
# include <wchar.h>
|
||||
# include <wctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT
|
||||
# include <print>
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
# ifndef _LIBCPP_HAS_NO_THREADS
|
||||
# include <future>
|
||||
# include <mutex>
|
||||
# include <thread>
|
||||
# endif
|
||||
|
||||
# include <experimental/deque>
|
||||
# include <experimental/forward_list>
|
||||
# include <experimental/iterator>
|
||||
# include <experimental/list>
|
||||
# include <experimental/map>
|
||||
# include <experimental/memory_resource>
|
||||
# include <experimental/propagate_const>
|
||||
# ifndef _LIBCPP_HAS_NO_LOCALIZATION
|
||||
# include <experimental/regex>
|
||||
# endif
|
||||
# include <experimental/set>
|
||||
# include <experimental/simd>
|
||||
# include <experimental/string>
|
||||
# include <experimental/type_traits>
|
||||
# include <experimental/unordered_map>
|
||||
# include <experimental/unordered_set>
|
||||
# include <experimental/utility>
|
||||
# include <experimental/vector>
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
# ifndef _LIBCPP_HAS_NO_THREADS
|
||||
# include <shared_mutex>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
# ifndef _LIBCPP_HAS_NO_FILESYSTEM
|
||||
# include <filesystem>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 20
|
||||
# include <coroutine>
|
||||
|
||||
# ifndef _LIBCPP_HAS_NO_THREADS
|
||||
# include <barrier>
|
||||
# include <latch>
|
||||
# include <semaphore>
|
||||
# include <stop_token>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 23
|
||||
# ifndef _LIBCPP_HAS_NO_THREADS
|
||||
# include <stdatomic.h>
|
||||
# endif
|
||||
#endif
|
@ -627,6 +627,13 @@ module std_experimental [system] {
|
||||
}
|
||||
}
|
||||
|
||||
// Convenience method to get all of the above modules in a single import statement.
|
||||
// Importing only the needed modules is likely to be more performant.
|
||||
module std [system] {
|
||||
header "__std_clang_module"
|
||||
export *
|
||||
}
|
||||
|
||||
// Implementation detail headers that are private to libc++. These modules
|
||||
// must not be directly imported.
|
||||
module std_private_assert [system] {
|
||||
|
@ -44,3 +44,34 @@ for header in public_headers:
|
||||
|
||||
#include <{header}>
|
||||
""")
|
||||
|
||||
print(f"""
|
||||
//--- __std_clang_module.compile.pass.mm
|
||||
// RUN{BLOCKLIT}: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
|
||||
|
||||
// REQUIRES{BLOCKLIT}: modules-build
|
||||
// UNSUPPORTED{BLOCKLIT}: use_module_std
|
||||
|
||||
// GCC doesn't support -fcxx-modules
|
||||
// UNSUPPORTED{BLOCKLIT}: gcc
|
||||
|
||||
// The Windows headers don't appear to be compatible with modules
|
||||
// UNSUPPORTED{BLOCKLIT}: windows
|
||||
// UNSUPPORTED{BLOCKLIT}: buildhost=windows
|
||||
|
||||
// The AIX headers don't appear to be compatible with modules
|
||||
// UNSUPPORTED{BLOCKLIT}: LIBCXX-AIX-FIXME
|
||||
|
||||
// The Android headers don't appear to be compatible with modules yet
|
||||
// XFAIL{BLOCKLIT}: LIBCXX-ANDROID-FIXME
|
||||
|
||||
// TODO: Investigate this failure
|
||||
// UNSUPPORTED{BLOCKLIT}: LIBCXX-FREEBSD-FIXME
|
||||
|
||||
// Lit seems to compile this twice: once with the default flags and once with with
|
||||
// the flags specified in the RUN directive. Guard the first compile from failing.
|
||||
#if __has_feature(modules)
|
||||
@import std;
|
||||
#endif
|
||||
|
||||
""")
|
||||
|
@ -77,6 +77,8 @@ def generate_map(include):
|
||||
continue
|
||||
elif i == "__split_buffer":
|
||||
public = ["deque", "vector"]
|
||||
elif i == "__std_clang_module":
|
||||
continue
|
||||
elif i == "__std_mbstate_t.h":
|
||||
continue
|
||||
elif i == "__threading_support":
|
||||
|
Loading…
Reference in New Issue
Block a user