Skip to content

[libc++] Remove <locale> includes from <format> #85478

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
Mar 16, 2024

Conversation

philnik777
Copy link
Contributor

This reduces the include time from 767ms to 691ms.

@philnik777 philnik777 requested a review from a team as a code owner March 15, 2024 22:29
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Mar 15, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 15, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

This reduces the include time from 767ms to 691ms.


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

3 Files Affected:

  • (modified) libcxx/include/__format/format_context.h (+1-1)
  • (modified) libcxx/include/__format/format_functions.h (+1-1)
  • (modified) libcxx/include/__format/formatter_floating_point.h (+1-1)
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index d131e942aca60b..bf603c5c62d9db 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -27,7 +27,7 @@
 #include <cstddef>
 
 #ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#  include <locale>
+#  include <__locale>
 #  include <optional>
 #endif
 
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 3ee53539f4ee6c..c7810140105a07 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -41,7 +41,7 @@
 #include <string_view>
 
 #ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#  include <locale>
+#  include <__locale>
 #endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h
index f01d323efff5fc..1d94cc349c0dd6 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -39,7 +39,7 @@
 #include <cstddef>
 
 #ifndef _LIBCPP_HAS_NO_LOCALIZATION
-#  include <locale>
+#  include <__locale>
 #endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

This reduces the include time from 767ms to 691ms.
@philnik777 philnik777 force-pushed the format_remove_locale_include branch from 482dcb9 to 41cbca7 Compare March 15, 2024 22:49
@philnik777
Copy link
Contributor Author

I'm landing it, since this should be a completely uncontroversial change.

@philnik777 philnik777 merged commit 5bcb781 into llvm:main Mar 16, 2024
@philnik777 philnik777 deleted the format_remove_locale_include branch March 16, 2024 12:45
chrono forward_list
chrono limits
chrono locale
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks controversial. Why is it correct to remove this include in C++20. (Not objections the change in C++23 and C++26.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I missed that removal. That wasn't meant to be here. Weird though that it's only showing up in C++20.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, I just approved it.

philnik777 added a commit that referenced this pull request Mar 16, 2024
I accidentally removed this transitive include in #85478.
var-const added a commit to var-const/llvm-project that referenced this pull request Jul 17, 2024
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.

3 participants