[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
NOKEYCHECK=True
GitOrigin-RevId: 5aaefa510ef055e8f044ca89e352d4313f3aba49
diff --git a/src/cxa_exception_storage.cpp b/src/cxa_exception_storage.cpp
index 3a3233a..ce44c3a 100644
--- a/src/cxa_exception_storage.cpp
+++ b/src/cxa_exception_storage.cpp
@@ -12,7 +12,7 @@
#include "cxa_exception.h"
-#include <__threading_support>
+#include "threading_support.h"
#if defined(_LIBCXXABI_HAS_NO_THREADS)
diff --git a/src/cxa_guard_impl.h b/src/cxa_guard_impl.h
index 72940cc..b3c3202 100644
--- a/src/cxa_guard_impl.h
+++ b/src/cxa_guard_impl.h
@@ -56,7 +56,7 @@
#include <limits.h>
#include <stdlib.h>
-#include <__threading_support>
+#include "threading_support.h"
#ifndef _LIBCXXABI_HAS_NO_THREADS
# if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
# pragma comment(lib, "pthread")
diff --git a/src/cxa_thread_atexit.cpp b/src/cxa_thread_atexit.cpp
index 665f9e5..1a04ddd 100644
--- a/src/cxa_thread_atexit.cpp
+++ b/src/cxa_thread_atexit.cpp
@@ -8,7 +8,7 @@
#include "abort_message.h"
#include "cxxabi.h"
-#include <__threading_support>
+#include "threading_support.h"
#ifndef _LIBCXXABI_HAS_NO_THREADS
#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
#pragma comment(lib, "pthread")
diff --git a/src/fallback_malloc.cpp b/src/fallback_malloc.cpp
index 1d6c380..9db431e 100644
--- a/src/fallback_malloc.cpp
+++ b/src/fallback_malloc.cpp
@@ -8,7 +8,7 @@
#include "fallback_malloc.h"
-#include <__threading_support>
+#include "threading_support.h"
#ifndef _LIBCXXABI_HAS_NO_THREADS
#if defined(__ELF__) && defined(_LIBCXXABI_LINK_PTHREAD_LIB)
#pragma comment(lib, "pthread")