Skip to content

Commit 42b391a

Browse files
committed
add inline namespace for align
1 parent fa06bc2 commit 42b391a

File tree

6 files changed

+10
-51
lines changed

6 files changed

+10
-51
lines changed

libcxx/include/__configuration/abi.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@
104104
# endif
105105
#endif
106106

107-
// The PE/COFF format reports a linking error when encountering multiple symbol definitions where at least one is a
108-
// strong symbol. So we can't inline a function that also has a non-inline definition visible.
109-
#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
110-
# define _LIBCPP_DISABLE_INLINE_OPTIMIZE_BECAUSE_MULTIPLY_SYMBOLS_ERROR
111-
#endif
112-
113107
// TODO(LLVM 22): Remove this check
114108
#if defined(_LIBCPP_ABI_NO_ITERATOR_BASES) && !defined(_LIBCPP_ABI_NO_REVERSE_ITERATOR_SECOND_MEMBER)
115109
# ifndef _LIBCPP_ONLY_NO_ITERATOR_BASES

libcxx/include/__memory/align.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919

2020
_LIBCPP_BEGIN_NAMESPACE_STD
2121

22-
#if defined(_LIBCPP_DISABLE_INLINE_OPTIMIZE_BECAUSE_MULTIPLY_SYMBOLS_ERROR) && !defined(_LIBCPP_ABI_DO_NOT_EXPORT_ALIGN)
23-
24-
_LIBCPP_EXPORTED_FROM_ABI void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
25-
26-
#else
27-
22+
inline namespace __align_inline {
2823
_LIBCPP_HIDE_FROM_ABI inline void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space) {
2924
void* __r = nullptr;
3025
if (__sz <= __space) {
@@ -40,7 +35,7 @@ _LIBCPP_HIDE_FROM_ABI inline void* align(size_t __align, size_t __sz, void*& __p
4035
return __r;
4136
}
4237

43-
#endif
38+
} // namespace __align_inline
4439

4540
_LIBCPP_END_NAMESPACE_STD
4641

libcxx/src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ set(LIBCXX_SOURCES
3131
include/to_chars_floating_point.h
3232
include/from_chars_floating_point.h
3333
memory.cpp
34-
memory_align.cpp
3534
memory_resource.cpp
3635
new_handler.cpp
3736
new_helpers.cpp

libcxx/src/memory.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,12 @@ __sp_mut& __get_sp_mut(const void* p) {
132132

133133
#endif // _LIBCPP_HAS_THREADS
134134

135+
#if !defined(_LIBCPP_ABI_DO_NOT_EXPORT_ALIGN)
136+
137+
_LIBCPP_EXPORTED_FROM_ABI void* align(size_t alignment, size_t size, void*& ptr, size_t& space) {
138+
return __align_inline::align(alignment, size, ptr, space);
139+
}
140+
141+
#endif // _LIBCPP_ABI_DO_NOT_EXPORT_ALIGN
142+
135143
_LIBCPP_END_NAMESPACE_STD

libcxx/src/memory_align.cpp

Lines changed: 0 additions & 36 deletions
This file was deleted.

llvm/utils/gn/secondary/libcxx/src/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ cxx_sources = [
152152
"iostream.cpp",
153153
"locale.cpp",
154154
"memory.cpp",
155-
"memory_align.cpp"
156155
"memory_resource.cpp",
157156
"mutex.cpp",
158157
"mutex_destructor.cpp",

0 commit comments

Comments
 (0)