Skip to content

Commit 941fdea

Browse files
committed
[build] hide some symbols in LLVMSupport
Reintroduce some changes done in swiftlang#23131 to hide some weak symbols generated when compiling as part of libswiftDemangle.dylib, which may introduce a performance regression. Addresses rdar://63454568
1 parent 417e173 commit 941fdea

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

stdlib/include/llvm/ADT/SmallVector.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,43 @@ template <class Size_T> class SmallVectorBase {
5050
Size_T Size = 0, Capacity;
5151

5252
/// The maximum value of the Size_T used.
53+
#if !defined(_WIN32)
54+
__attribute__((__visibility__("hidden")))
55+
#endif
5356
static constexpr size_t SizeTypeMax() {
5457
return std::numeric_limits<Size_T>::max();
5558
}
5659

5760
SmallVectorBase() = delete;
61+
#if !defined(_WIN32)
62+
__attribute__((__visibility__("hidden")))
63+
#endif
5864
SmallVectorBase(void *FirstEl, size_t TotalCapacity)
5965
: BeginX(FirstEl), Capacity(TotalCapacity) {}
6066

6167
/// This is an implementation of the grow() method which only works
6268
/// on POD-like data types and is out of line to reduce code duplication.
6369
/// This function will report a fatal error if it cannot increase capacity.
70+
#if !defined(_WIN32)
71+
__attribute__((__visibility__("hidden")))
72+
#endif
6473
void grow_pod(void *FirstEl, size_t MinCapacity, size_t TSize);
6574

6675
public:
76+
#if !defined(_WIN32)
77+
__attribute__((__visibility__("hidden")))
78+
#endif
6779
size_t size() const { return Size; }
80+
#if !defined(_WIN32)
81+
__attribute__((__visibility__("hidden")))
82+
#endif
6883
size_t capacity() const { return Capacity; }
6984

70-
LLVM_NODISCARD bool empty() const { return !Size; }
85+
LLVM_NODISCARD
86+
#if !defined(_WIN32)
87+
__attribute__((__visibility__("hidden")))
88+
#endif
89+
bool empty() const { return !Size; }
7190

7291
/// Set the array size to \p N, which the current array must have enough
7392
/// capacity for.
@@ -78,6 +97,9 @@ template <class Size_T> class SmallVectorBase {
7897
/// of the buffer when they know that more elements are available, and only
7998
/// update the size later. This avoids the cost of value initializing elements
8099
/// which will only be overwritten.
100+
#if !defined(_WIN32)
101+
__attribute__((__visibility__("hidden")))
102+
#endif
81103
void set_size(size_t N) {
82104
assert(N <= capacity());
83105
Size = N;

0 commit comments

Comments
 (0)