Skip to content

Commit 5aaefa5

Browse files
committed
[libcxx][modules] protects users from relying on detail headers
libc++ has started splicing standard library headers into much more fine-grained content for maintainability. It's very likely that outdated and naive tooling (some of which is outside of LLVM's scope) will suggest users include things such as <__ranges/access.h> instead of <ranges>, and Hyrum's law suggests that users will eventually begin to rely on this without the help of tooling. As such, this commit intends to protect users from themselves, by making it a hard error for anyone outside of the standard library to include libc++ detail headers. Differential Revision: https://reviews.llvm.org/D106124
1 parent 274ec42 commit 5aaefa5

File tree

1,147 files changed

+8785
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,147 files changed

+8785
-13
lines changed

libcxx/cmake/Modules/HandleLibCXXABI.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
117117

118118
setup_abi_lib(
119119
"-DLIBCXX_BUILDING_LIBCXXABI"
120-
"${shared}" "${static}" "cxxabi.h;__cxxabi_config.h" "")
120+
"${shared}" "${static}" "cxxabi.h;__cxxabi_config.h;threading_support.h" "")
121121
elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
122122
if(NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)
123123
set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")

libcxx/include/__algorithm/adjacent_find.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1818
# pragma GCC system_header
19+
# pragma clang include_instead(<algorithm>)
1920
#endif
2021

2122
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/all_of.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1616
# pragma GCC system_header
17+
# pragma clang include_instead(<algorithm>)
1718
#endif
1819

1920
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/any_of.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1616
# pragma GCC system_header
17+
# pragma clang include_instead(<algorithm>)
1718
#endif
1819

1920
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/binary_search.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1919
# pragma GCC system_header
20+
# pragma clang include_instead(<algorithm>)
2021
#endif
2122

2223
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/clamp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1717
# pragma GCC system_header
18+
# pragma clang include_instead(<algorithm>)
1819
#endif
1920

2021
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/comp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1515
# pragma GCC system_header
16+
# pragma clang include_instead(<algorithm>)
1617
#endif
1718

1819
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/comp_ref_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1818
# pragma GCC system_header
19+
# pragma clang include_instead(<algorithm>)
1920
#endif
2021

2122
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/copy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1919
# pragma GCC system_header
20+
# pragma clang include_instead(<algorithm>)
2021
#endif
2122

2223
_LIBCPP_BEGIN_NAMESPACE_STD

libcxx/include/__algorithm/copy_backward.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1919
# pragma GCC system_header
20+
# pragma clang include_instead(<algorithm>)
2021
#endif
2122

2223
_LIBCPP_BEGIN_NAMESPACE_STD

0 commit comments

Comments
 (0)