-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration #98075
Conversation
@llvm/pr-subscribers-backend-amdgpu @llvm/pr-subscribers-libc Author: Petr Hosek (petrhosek) ChangesThis is a part of #97655. Patch is 1.25 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/98075.diff 2300 Files Affected:
diff --git a/libc/benchmarks/LibcDefaultImplementations.cpp b/libc/benchmarks/LibcDefaultImplementations.cpp
index c50ae00ffa105..d19c4403329de 100644
--- a/libc/benchmarks/LibcDefaultImplementations.cpp
+++ b/libc/benchmarks/LibcDefaultImplementations.cpp
@@ -2,7 +2,7 @@
#include "llvm/ADT/ArrayRef.h"
#include <cstddef>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
extern void *memmove(void *, const void *, size_t);
@@ -11,7 +11,7 @@ extern void bzero(void *, size_t);
extern int memcmp(const void *, const void *, size_t);
extern int bcmp(const void *, const void *, size_t);
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
// List of implementations to test.
diff --git a/libc/benchmarks/LibcMemoryBenchmarkMain.cpp b/libc/benchmarks/LibcMemoryBenchmarkMain.cpp
index bc6fd8b38cb6d..ab2d763a4f7a2 100644
--- a/libc/benchmarks/LibcMemoryBenchmarkMain.cpp
+++ b/libc/benchmarks/LibcMemoryBenchmarkMain.cpp
@@ -21,7 +21,7 @@
#include <cstring>
#include <unistd.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
extern void *memmove(void *, const void *, size_t);
@@ -30,7 +30,7 @@ extern void bzero(void *, size_t);
extern int memcmp(const void *, const void *, size_t);
extern int bcmp(const void *, const void *, size_t);
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
namespace llvm {
namespace libc_benchmarks {
diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
index 3837bd97d9f9a..1563c9be14ed2 100644
--- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp
+++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp
@@ -542,11 +542,11 @@ static void Serialize(raw_ostream &Stream,
Stream << "using llvm::libc_benchmarks::MemmoveConfiguration;\n";
Stream << "using llvm::libc_benchmarks::MemsetConfiguration;\n";
Stream << "\n";
- Stream << "namespace LIBC_NAMESPACE {\n";
+ Stream << "namespace LIBC_NAMESPACE_DECL {\n";
Stream << "\n";
codegen::functions::Serialize(Stream, Descriptors);
Stream << "\n";
- Stream << "} // namespace LIBC_NAMESPACE\n";
+ Stream << "} // namespace LIBC_NAMESPACE_DECL\n";
Stream << "\n";
Stream << "namespace llvm {\n";
Stream << "namespace automemcpy {\n";
diff --git a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
index 5084b1d67dcd5..77c094d893b48 100644
--- a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
+++ b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp
@@ -63,7 +63,7 @@ using llvm::libc_benchmarks::MemcpyConfiguration;
using llvm::libc_benchmarks::MemmoveConfiguration;
using llvm::libc_benchmarks::MemsetConfiguration;
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) {
using namespace LIBC_NAMESPACE::x86;
@@ -134,7 +134,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) {
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
namespace llvm {
namespace automemcpy {
diff --git a/libc/benchmarks/gpu/BenchmarkLogger.cpp b/libc/benchmarks/gpu/BenchmarkLogger.cpp
index 2e7e8e7600fdb..5c7608d6b662d 100644
--- a/libc/benchmarks/gpu/BenchmarkLogger.cpp
+++ b/libc/benchmarks/gpu/BenchmarkLogger.cpp
@@ -8,7 +8,7 @@
#include <stdint.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
// cpp::string_view specialization
@@ -94,4 +94,4 @@ template BenchmarkLogger &BenchmarkLogger::operator<< <UInt<320>>(UInt<320>);
BenchmarkLogger log;
} // namespace benchmarks
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/benchmarks/gpu/BenchmarkLogger.h b/libc/benchmarks/gpu/BenchmarkLogger.h
index 332ff1439e6f5..5685c9dd65908 100644
--- a/libc/benchmarks/gpu/BenchmarkLogger.h
+++ b/libc/benchmarks/gpu/BenchmarkLogger.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H
#define LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
// A class to log to standard output in the context of hermetic tests.
@@ -22,6 +22,6 @@ struct BenchmarkLogger {
extern BenchmarkLogger log;
} // namespace benchmarks
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif /* LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H */
diff --git a/libc/benchmarks/gpu/LibcGpuBenchmark.cpp b/libc/benchmarks/gpu/LibcGpuBenchmark.cpp
index 7f60c9cc4a2f4..d66dc9c2266a0 100644
--- a/libc/benchmarks/gpu/LibcGpuBenchmark.cpp
+++ b/libc/benchmarks/gpu/LibcGpuBenchmark.cpp
@@ -7,7 +7,7 @@
#include "src/__support/fixedvector.h"
#include "src/time/gpu/time_utils.h"
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
FixedVector<Benchmark *, 64> benchmarks;
@@ -136,4 +136,4 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
};
} // namespace benchmarks
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/benchmarks/gpu/LibcGpuBenchmark.h b/libc/benchmarks/gpu/LibcGpuBenchmark.h
index ffc858911b1c0..91a1c158beca3 100644
--- a/libc/benchmarks/gpu/LibcGpuBenchmark.h
+++ b/libc/benchmarks/gpu/LibcGpuBenchmark.h
@@ -10,7 +10,7 @@
#include <stdint.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace benchmarks {
@@ -99,7 +99,7 @@ class Benchmark {
const cpp::string_view get_name() const { return name; }
};
} // namespace benchmarks
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#define BENCHMARK(SuiteName, TestName, Func) \
LIBC_NAMESPACE::benchmarks::Benchmark SuiteName##_##TestName##_Instance( \
diff --git a/libc/benchmarks/gpu/timing/nvptx/timing.h b/libc/benchmarks/gpu/timing/nvptx/timing.h
index d3851a764c43d..d141b08d4c922 100644
--- a/libc/benchmarks/gpu/timing/nvptx/timing.h
+++ b/libc/benchmarks/gpu/timing/nvptx/timing.h
@@ -16,7 +16,7 @@
#include <stdint.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
// Returns the overhead associated with calling the profiling region. This
// allows us to substract the constant-time overhead from the latency to
@@ -94,6 +94,6 @@ static LIBC_INLINE uint64_t latency(F f, T1 t1, T2 t2) {
return stop - start;
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_UTILS_GPU_TIMING_NVPTX
diff --git a/libc/config/linux/app.h b/libc/config/linux/app.h
index 2a3b1560817b8..28bd010f1e6eb 100644
--- a/libc/config/linux/app.h
+++ b/libc/config/linux/app.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
// Data structure to capture properties of the linux/ELF TLS image.
struct TLSImage {
@@ -104,6 +104,6 @@ void cleanup_tls(uintptr_t tls_addr, uintptr_t tls_size);
// Set the thread pointer for the current thread.
bool set_thread_ptr(uintptr_t val);
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_CONFIG_LINUX_APP_H
diff --git a/libc/fuzzing/__support/hashtable_fuzz.cpp b/libc/fuzzing/__support/hashtable_fuzz.cpp
index 07f1057714114..8a6d7fd52fd36 100644
--- a/libc/fuzzing/__support/hashtable_fuzz.cpp
+++ b/libc/fuzzing/__support/hashtable_fuzz.cpp
@@ -13,7 +13,7 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/HashTable/table.h"
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
// A fuzzing payload starts with
// - uint16_t: initial capacity for table A
@@ -179,4 +179,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
return 0;
}
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/__support/CPP/algorithm.h b/libc/src/__support/CPP/algorithm.h
index 5120fa0daae17..6ca4ce06a0e26 100644
--- a/libc/src/__support/CPP/algorithm.h
+++ b/libc/src/__support/CPP/algorithm.h
@@ -14,7 +14,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <class T> LIBC_INLINE constexpr const T &max(const T &a, const T &b) {
@@ -41,6 +41,6 @@ LIBC_INLINE constexpr bool all_of(InputIt first, InputIt last, UnaryPred p) {
}
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H
diff --git a/libc/src/__support/CPP/array.h b/libc/src/__support/CPP/array.h
index 4e69ba003e800..8cd5cc1133da2 100644
--- a/libc/src/__support/CPP/array.h
+++ b/libc/src/__support/CPP/array.h
@@ -13,7 +13,7 @@
#include "src/__support/macros/attributes.h"
#include <stddef.h> // For size_t.
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <class T, size_t N> struct array {
@@ -74,6 +74,6 @@ template <class T, size_t N> struct array {
};
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ARRAY_H
diff --git a/libc/src/__support/CPP/atomic.h b/libc/src/__support/CPP/atomic.h
index e273d998c0702..70cff09a2c511 100644
--- a/libc/src/__support/CPP/atomic.h
+++ b/libc/src/__support/CPP/atomic.h
@@ -14,7 +14,7 @@
#include "type_traits.h"
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
enum class MemoryOrder : int {
@@ -211,6 +211,6 @@ LIBC_INLINE void atomic_signal_fence([[maybe_unused]] MemoryOrder mem_ord) {
}
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ATOMIC_H
diff --git a/libc/src/__support/CPP/bit.h b/libc/src/__support/CPP/bit.h
index 4aea066d26ab0..56e8db1967da7 100644
--- a/libc/src/__support/CPP/bit.h
+++ b/libc/src/__support/CPP/bit.h
@@ -18,7 +18,8 @@
#include <stdint.h>
-namespace LIBC_NAMESPACE::cpp {
+namespace LIBC_NAMESPACE_DECL {
+namespace cpp {
#if __has_builtin(__builtin_memcpy_inline)
#define LLVM_LIBC_HAS_BUILTIN_MEMCPY_INLINE
@@ -290,6 +291,7 @@ ADD_SPECIALIZATION(unsigned long long, __builtin_popcountll)
#endif // __builtin_popcountg
#undef ADD_SPECIALIZATION
-} // namespace LIBC_NAMESPACE::cpp
+} // namespace cpp
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BIT_H
diff --git a/libc/src/__support/CPP/bitset.h b/libc/src/__support/CPP/bitset.h
index 30a7fa796cb4b..a476c2f361127 100644
--- a/libc/src/__support/CPP/bitset.h
+++ b/libc/src/__support/CPP/bitset.h
@@ -12,7 +12,8 @@
#include "src/__support/macros/attributes.h"
#include <stddef.h> // For size_t.
-namespace LIBC_NAMESPACE::cpp {
+namespace LIBC_NAMESPACE_DECL {
+namespace cpp {
template <size_t NumberOfBits> struct bitset {
static_assert(NumberOfBits != 0,
@@ -86,6 +87,7 @@ template <size_t NumberOfBits> struct bitset {
size_t Data[NUMBER_OF_UNITS] = {0};
};
-} // namespace LIBC_NAMESPACE::cpp
+} // namespace cpp
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BITSET_H
diff --git a/libc/src/__support/CPP/cstddef.h b/libc/src/__support/CPP/cstddef.h
index 1da51fd253fb5..2dd30a732f6e9 100644
--- a/libc/src/__support/CPP/cstddef.h
+++ b/libc/src/__support/CPP/cstddef.h
@@ -12,7 +12,8 @@
#include "src/__support/macros/attributes.h"
#include "type_traits.h" // For enable_if_t, is_integral_v.
-namespace LIBC_NAMESPACE::cpp {
+namespace LIBC_NAMESPACE_DECL {
+namespace cpp {
enum class byte : unsigned char {};
@@ -66,6 +67,7 @@ to_integer(byte b) noexcept {
return static_cast<IntegerType>(b);
}
-} // namespace LIBC_NAMESPACE::cpp
+} // namespace cpp
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H
diff --git a/libc/src/__support/CPP/expected.h b/libc/src/__support/CPP/expected.h
index c35f0a1dc5369..2c3cc67d44cc8 100644
--- a/libc/src/__support/CPP/expected.h
+++ b/libc/src/__support/CPP/expected.h
@@ -11,7 +11,8 @@
#include "src/__support/macros/attributes.h"
-namespace LIBC_NAMESPACE::cpp {
+namespace LIBC_NAMESPACE_DECL {
+namespace cpp {
// This is used to hold an unexpected value so that a different constructor is
// selected.
@@ -52,6 +53,7 @@ template <class T, class E> class expected {
LIBC_INLINE constexpr const T *operator->() const { return &exp; }
};
-} // namespace LIBC_NAMESPACE::cpp
+} // namespace cpp
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H
diff --git a/libc/src/__support/CPP/functional.h b/libc/src/__support/CPP/functional.h
index 16283a264e657..1d03ed8c2bdb5 100644
--- a/libc/src/__support/CPP/functional.h
+++ b/libc/src/__support/CPP/functional.h
@@ -20,7 +20,7 @@
#include <stdint.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
/// A function type adapted from LLVM's function_ref.
@@ -65,6 +65,6 @@ template <typename Ret, typename... Params> class function<Ret(Params...)> {
};
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_FUNCTIONAL_H
diff --git a/libc/src/__support/CPP/iterator.h b/libc/src/__support/CPP/iterator.h
index b0fd5c9f22ae0..3488dc64d1559 100644
--- a/libc/src/__support/CPP/iterator.h
+++ b/libc/src/__support/CPP/iterator.h
@@ -14,7 +14,7 @@
#include "src/__support/CPP/type_traits/is_same.h"
#include "src/__support/macros/attributes.h"
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
template <typename T> struct iterator_traits;
@@ -93,6 +93,6 @@ template <typename Iter> class reverse_iterator {
};
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ITERATOR_H
diff --git a/libc/src/__support/CPP/limits.h b/libc/src/__support/CPP/limits.h
index 5b9b3e755c72b..6b8c28770c781 100644
--- a/libc/src/__support/CPP/limits.h
+++ b/libc/src/__support/CPP/limits.h
@@ -15,7 +15,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
namespace internal {
@@ -86,6 +86,6 @@ struct numeric_limits<__uint128_t>
#endif
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_LIMITS_H
diff --git a/libc/src/__support/CPP/mutex.h b/libc/src/__support/CPP/mutex.h
index ff9c9f43a43cc..c6f02be50981b 100644
--- a/libc/src/__support/CPP/mutex.h
+++ b/libc/src/__support/CPP/mutex.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H
#define LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// Assume the calling thread has already obtained mutex ownership.
@@ -44,6 +44,6 @@ template <typename MutexType> class lock_guard {
template <typename T> lock_guard(T &) -> lock_guard<T>;
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H
diff --git a/libc/src/__support/CPP/new.h b/libc/src/__support/CPP/new.h
index 72187b70d7d24..024fe7e381501 100644
--- a/libc/src/__support/CPP/new.h
+++ b/libc/src/__support/CPP/new.h
@@ -23,7 +23,7 @@ enum class align_val_t : size_t {};
} // namespace std
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
class AllocChecker {
bool success = false;
@@ -52,7 +52,7 @@ class AllocChecker {
}
};
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
LIBC_INLINE void *operator new(size_t size,
LIBC_NAMESPACE::AllocChecker &ac) noexcept {
diff --git a/libc/src/__support/CPP/optional.h b/libc/src/__support/CPP/optional.h
index 2c0f639a2b342..f179425d24c1c 100644
--- a/libc/src/__support/CPP/optional.h
+++ b/libc/src/__support/CPP/optional.h
@@ -13,7 +13,7 @@
#include "src/__support/CPP/utility.h"
#include "src/__support/macros/attributes.h"
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// Trivial nullopt_t struct.
@@ -133,6 +133,6 @@ template <typename T> class optional {
};
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_OPTIONAL_H
diff --git a/libc/src/__support/CPP/span.h b/libc/src/__support/CPP/span.h
index a8c1353581ba0..f1cedf1bc90a1 100644
--- a/libc/src/__support/CPP/span.h
+++ b/libc/src/__support/CPP/span.h
@@ -15,7 +15,8 @@
#include "src/__support/macros/attributes.h"
-namespace LIBC_NAMESPACE::cpp {
+namespace LIBC_NAMESPACE_DECL {
+namespace cpp {
// A trimmed down implementation of std::span.
// Missing features:
@@ -119,6 +120,7 @@ template <typename T> class span {
size_t span_size;
};
-} // namespace LIBC_NAMESPACE::cpp
+} // namespace cpp
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_SPAN_H
diff --git a/libc/src/__support/CPP/string.h b/libc/src/__support/CPP/string.h
index cb794e081970d..2b7514b87d956 100644
--- a/libc/src/__support/CPP/string.h
+++ b/libc/src/__support/CPP/string.h
@@ -18,7 +18,7 @@
#include <stddef.h> // size_t
#include <stdlib.h> // malloc, free
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This class mimics std::string but does not intend to be a full fledged
@@ -225,6 +225,6 @@ LIBC_INLINE string to_string(unsigned long long value) {
// LIBC_INLINE string to_string(long double value);
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_H
diff --git a/libc/src/__support/CPP/string_view.h b/libc/src/__support/CPP/string_view.h
index 8aa96fa87f698..64d88b9e080d7 100644
--- a/libc/src/__support/CPP/string_view.h
+++ b/libc/src/__support/CPP/string_view.h
@@ -13,7 +13,7 @@
#include <stddef.h>
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This is very simple alternate of the std::string_view class. There is no
@@ -214,6 +214,6 @@ class string_view {
};
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRING_VIEW_H
diff --git a/libc/src/__support/CPP/stringstream.h b/libc/src/__support/CPP/stringstream.h
index c8eb59cf65cbb..ff7f9c34cea40 100644
--- a/libc/src/__support/CPP/stringstream.h
+++ b/libc/src/__support/CPP/stringstream.h
@@ -15,7 +15,7 @@
#include "src/__support/integer_to_string.h"
-namespace LIBC_NAMESPACE {
+namespace LIBC_NAMESPACE_DECL {
namespace cpp {
// This class is to be used to write simple strings into a user provided buffer
@@ -90,6 +90,6 @@ class StringStream {
};
} // namespace cpp
-} // namespace LIBC_NAMESPACE
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_STRINGSTREAM_H
diff --git a/libc/src/__support/CPP/type_traits/add_lvalue_reference.h b/libc/src/__support/CPP/type_traits/add_lvalue_reference.h
index 2bca6267914d5..7a0e5ce8829ec 100644
--- a/libc/src/__support/CPP/type_traits/add_lvalue_reference.h
+++ b/libc/src/__support/CPP/type_traits/add_lvalue_reference.h
@@ -10,7 +10,8 @@
#include "src/__support/CPP/type_traits/type_identity.h"
-namespace LIBC_NAMESPACE::cpp {
+namespace LIBC_NAMESPACE_DECL {
+namespace cpp {
// add_lvalue_reference
namespace detail {
@@ -25,6 +26,7 @@ struct add_lvalue_reference : decltype(detail::try_add_lvalue_reference<T>(0)) {
template <class T>
using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;
-} // namespace LIBC_NAMESPACE::cpp
+} // namespace cpp
+} // namespace LIBC_NAMESPACE_DECL
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_LVALUE_REFERENCE_H
diff --git a/libc/src/__support/CPP/type_traits/add_pointer.h b/libc/src/__support/CPP/type_traits/add_pointer.h
index 1257033ee80e2..bdd11d4df88f4 100644
--- a/libc/src/__support/CPP/type_traits/add_pointer.h
+++ b/libc/src/__support/CPP/type_traits/add_pointer.h
@@ -11,7 +11,8 @@
#include "src/__support/CPP/type_t...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
So, this replaces every single namespace declaration with the following? #define LIBC_NAMESPACE_DECL [[gnu::visibility("hidden")]] LIBC_NAMESPACE Before that we need to identify all the entrypoints and make sure they retain default visibility. @frobtech suggested that we split that up into introducing a macro for exporting global variables, then we'd need to make sure that However, that's if we want non-hidden visibility at all. The main effect of everything being hidden is that if someone does |
Correct, although it's currently incomplete. Specifically because |
Alright, so this is basically the effect of compiling with |
No,
That's why |
I see, so external functions will be considered to have default visibility. I never noticed because in the LTO case they will just be resolved before even seeing the linker. I suppose this is because it's impossible to guess whether or not a global outside the TU. |
7ce5682
to
f7378ba
Compare
I used |
3f6bb6a
to
c6f172b
Compare
c6f172b
to
c3978ed
Compare
3f45ab5
to
cf5d87f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b4093aa
to
0db71fb
Compare
0db71fb
to
dc5519d
Compare
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/1907 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/71/builds/1942 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/179/builds/1905 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/171/builds/1888 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/2695 Here is the relevant piece of the build log for the reference:
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/183/builds/1231 Here is the relevant piece of the build log for the reference:
|
Bots are still broken right now, I’ll revert for now. |
Do you have a link to the broken bots? I wasn't aware of any further issues. |
You can navigate the links in the comments posted above, the failure that got me here was: https://lab.llvm.org/buildbot/#/builders/153/builds/2695 |
…laration" (llvm#98593) Reverts llvm#98075 bots are broken
This is a part of #97655.