Skip to content

[libc++] Fix missing #includes #130536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged

[libc++] Fix missing #includes #130536

merged 1 commit into from
May 12, 2025

Conversation

matts1
Copy link
Contributor

@matts1 matts1 commented Mar 10, 2025

Adds missing includes that were detected when I tried to build libc++ as a module.

Working towards #127012

@matts1 matts1 requested a review from a team as a code owner March 10, 2025 01:17
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Mar 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 10, 2025

@llvm/pr-subscribers-libcxx

Author: Matt (matts1)

Changes

Adds missing includes that were detected when I tried to build libc++ as a module.

Working towards #127012


Full diff: https://github.com/llvm/llvm-project/pull/130536.diff

15 Files Affected:

  • (modified) libcxx/include/__iterator/wrap_iter.h (+1)
  • (modified) libcxx/src/condition_variable.cpp (+4)
  • (modified) libcxx/src/filesystem/directory_iterator.cpp (+1)
  • (modified) libcxx/src/filesystem/error.h (+1)
  • (modified) libcxx/src/filesystem/filesystem_clock.cpp (+1)
  • (modified) libcxx/src/filesystem/filesystem_error.cpp (+1)
  • (modified) libcxx/src/filesystem/operations.cpp (+1)
  • (modified) libcxx/src/include/ryu/common.h (+1)
  • (modified) libcxx/src/memory.cpp (+2)
  • (modified) libcxx/src/mutex.cpp (+1)
  • (modified) libcxx/src/random.cpp (+1)
  • (modified) libcxx/src/ryu/d2fixed.cpp (+1)
  • (modified) libcxx/src/ryu/d2s.cpp (+1)
  • (modified) libcxx/src/ryu/f2s.cpp (+2)
  • (modified) libcxx/src/thread.cpp (+2)
diff --git a/libcxx/include/__iterator/wrap_iter.h b/libcxx/include/__iterator/wrap_iter.h
index 966c4675b7049..f0400e663de49 100644
--- a/libcxx/include/__iterator/wrap_iter.h
+++ b/libcxx/include/__iterator/wrap_iter.h
@@ -24,6 +24,7 @@
 #include <__type_traits/is_convertible.h>
 #include <__type_traits/is_same.h>
 #include <__type_traits/make_const_lvalue_ref.h>
+#include <__utility/pair.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp
index b3747603dd34f..3d241a7532cdc 100644
--- a/libcxx/src/condition_variable.cpp
+++ b/libcxx/src/condition_variable.cpp
@@ -6,8 +6,12 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <chrono>
 #include <condition_variable>
+#include <limits>
+#include <ratio>
 #include <thread>
+#include <__system_error/throw_system_error.h>
 
 #if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
 #  pragma comment(lib, "pthread")
diff --git a/libcxx/src/filesystem/directory_iterator.cpp b/libcxx/src/filesystem/directory_iterator.cpp
index 7e8e40d17f7a0..7d00c4933fc3e 100644
--- a/libcxx/src/filesystem/directory_iterator.cpp
+++ b/libcxx/src/filesystem/directory_iterator.cpp
@@ -8,6 +8,7 @@
 
 #include <__assert>
 #include <__config>
+#include <__memory/shared_ptr.h>
 #include <errno.h>
 #include <filesystem>
 #include <stack>
diff --git a/libcxx/src/filesystem/error.h b/libcxx/src/filesystem/error.h
index 7d81d4b6d2143..52a18b2becdbf 100644
--- a/libcxx/src/filesystem/error.h
+++ b/libcxx/src/filesystem/error.h
@@ -10,6 +10,7 @@
 #define FILESYSTEM_ERROR_H
 
 #include <__assert>
+#include <__chrono/time_point.h>
 #include <__config>
 #include <cerrno>
 #include <cstdarg>
diff --git a/libcxx/src/filesystem/filesystem_clock.cpp b/libcxx/src/filesystem/filesystem_clock.cpp
index bec082f61c9d3..0923342989bea 100644
--- a/libcxx/src/filesystem/filesystem_clock.cpp
+++ b/libcxx/src/filesystem/filesystem_clock.cpp
@@ -10,6 +10,7 @@
 #include <__system_error/throw_system_error.h>
 #include <chrono>
 #include <filesystem>
+#include <ratio>
 #include <time.h>
 
 #if defined(_LIBCPP_WIN32API)
diff --git a/libcxx/src/filesystem/filesystem_error.cpp b/libcxx/src/filesystem/filesystem_error.cpp
index 456b902c33154..0d8185fb5c3aa 100644
--- a/libcxx/src/filesystem/filesystem_error.cpp
+++ b/libcxx/src/filesystem/filesystem_error.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include <__config>
+#include <__memory/shared_ptr.h>
 #include <__utility/unreachable.h>
 #include <filesystem>
 #include <system_error>
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index 23c1c281ba1c7..b71f94a89d6df 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -6,6 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <__algorithm/copy.h>
 #include <__assert>
 #include <__config>
 #include <__utility/unreachable.h>
diff --git a/libcxx/src/include/ryu/common.h b/libcxx/src/include/ryu/common.h
index d5168d8710bf2..591ec414f850d 100644
--- a/libcxx/src/include/ryu/common.h
+++ b/libcxx/src/include/ryu/common.h
@@ -44,6 +44,7 @@
 
 #include <__assert>
 #include <__config>
+#include <cstdint>
 #include <cstring>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
index 16190c242c148..9be40cb9c1285 100644
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -11,7 +11,9 @@
 #  define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
 #endif
 
+#include <__functional/hash.h>
 #include <memory>
+#include <typeinfo>
 
 #if _LIBCPP_HAS_THREADS
 #  include <mutex>
diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp
index b2193e2335ee2..5b1e7da121fc4 100644
--- a/libcxx/src/mutex.cpp
+++ b/libcxx/src/mutex.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include <__assert>
+#include <__system_error/throw_system_error.h>
 #include <__thread/id.h>
 #include <__utility/exception_guard.h>
 #include <limits>
diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp
index ff53a3d786dd5..5c6644811bfee 100644
--- a/libcxx/src/random.cpp
+++ b/libcxx/src/random.cpp
@@ -16,6 +16,7 @@
 #include <__system_error/throw_system_error.h>
 #include <limits>
 #include <random>
+#include <string>
 
 #include <errno.h>
 #include <stdio.h>
diff --git a/libcxx/src/ryu/d2fixed.cpp b/libcxx/src/ryu/d2fixed.cpp
index 4cfc39535988e..abfa340830b1b 100644
--- a/libcxx/src/ryu/d2fixed.cpp
+++ b/libcxx/src/ryu/d2fixed.cpp
@@ -42,6 +42,7 @@
 #include <__assert>
 #include <__config>
 #include <charconv>
+#include <cstddef>
 #include <cstring>
 
 #include "include/ryu/common.h"
diff --git a/libcxx/src/ryu/d2s.cpp b/libcxx/src/ryu/d2s.cpp
index 5b80ed8a709d8..c0d11107f880b 100644
--- a/libcxx/src/ryu/d2s.cpp
+++ b/libcxx/src/ryu/d2s.cpp
@@ -42,6 +42,7 @@
 #include <__assert>
 #include <__config>
 #include <charconv>
+#include <cstddef>
 
 #include "include/ryu/common.h"
 #include "include/ryu/d2fixed.h"
diff --git a/libcxx/src/ryu/f2s.cpp b/libcxx/src/ryu/f2s.cpp
index f42fbd68c91d2..f1f8cdf83f86a 100644
--- a/libcxx/src/ryu/f2s.cpp
+++ b/libcxx/src/ryu/f2s.cpp
@@ -42,6 +42,8 @@
 #include <__assert>
 #include <__config>
 #include <charconv>
+#include <cstdint>
+#include <cstddef>
 
 #include "include/ryu/common.h"
 #include "include/ryu/d2fixed.h"
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp
index db40d9df4f233..028d36e3bfb37 100644
--- a/libcxx/src/thread.cpp
+++ b/libcxx/src/thread.cpp
@@ -6,8 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <__system_error/throw_system_error.h>
 #include <__thread/poll_with_backoff.h>
 #include <__thread/timed_backoff_policy.h>
+#include <__utility/pair.h>
 #include <exception>
 #include <future>
 #include <limits>

@matts1 matts1 force-pushed the push-qxrwvkwqvylw branch from db150e7 to cbfb030 Compare March 10, 2025 01:40
@matts1 matts1 force-pushed the push-qxrwvkwqvylw branch from cbfb030 to 6ca45e6 Compare March 11, 2025 01:21
@matts1 matts1 force-pushed the push-qxrwvkwqvylw branch from 6ca45e6 to 60f4b3b Compare March 14, 2025 01:16
@matts1 matts1 requested a review from philnik777 March 19, 2025 23:27
@matts1
Copy link
Contributor Author

matts1 commented Apr 15, 2025

@philnik777 ping, could you get this merged?

@ldionne ldionne merged commit 769c6a9 into llvm:main May 12, 2025
21 checks passed
Copy link

@matts1 Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants