Skip to content

Commit fdb98d9

Browse files
committed
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration
This is a part of #97655.
1 parent 5e56d74 commit fdb98d9

File tree

2,302 files changed

+4826
-4615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,302 files changed

+4826
-4615
lines changed

libc/benchmarks/LibcDefaultImplementations.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "llvm/ADT/ArrayRef.h"
33
#include <cstddef>
44

5-
namespace LIBC_NAMESPACE {
5+
namespace LIBC_NAMESPACE_DECL {
66

77
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
88
extern void *memmove(void *, const void *, size_t);
@@ -11,7 +11,7 @@ extern void bzero(void *, size_t);
1111
extern int memcmp(const void *, const void *, size_t);
1212
extern int bcmp(const void *, const void *, size_t);
1313

14-
} // namespace LIBC_NAMESPACE
14+
} // namespace LIBC_NAMESPACE_DECL
1515

1616
// List of implementations to test.
1717

libc/benchmarks/LibcMemoryBenchmarkMain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <cstring>
2222
#include <unistd.h>
2323

24-
namespace LIBC_NAMESPACE {
24+
namespace LIBC_NAMESPACE_DECL {
2525

2626
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
2727
extern void *memmove(void *, const void *, size_t);
@@ -30,7 +30,7 @@ extern void bzero(void *, size_t);
3030
extern int memcmp(const void *, const void *, size_t);
3131
extern int bcmp(const void *, const void *, size_t);
3232

33-
} // namespace LIBC_NAMESPACE
33+
} // namespace LIBC_NAMESPACE_DECL
3434

3535
namespace llvm {
3636
namespace libc_benchmarks {

libc/benchmarks/automemcpy/lib/CodeGen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,11 @@ static void Serialize(raw_ostream &Stream,
542542
Stream << "using llvm::libc_benchmarks::MemmoveConfiguration;\n";
543543
Stream << "using llvm::libc_benchmarks::MemsetConfiguration;\n";
544544
Stream << "\n";
545-
Stream << "namespace LIBC_NAMESPACE {\n";
545+
Stream << "namespace LIBC_NAMESPACE_DECL {\n";
546546
Stream << "\n";
547547
codegen::functions::Serialize(Stream, Descriptors);
548548
Stream << "\n";
549-
Stream << "} // namespace LIBC_NAMESPACE\n";
549+
Stream << "} // namespace LIBC_NAMESPACE_DECL\n";
550550
Stream << "\n";
551551
Stream << "namespace llvm {\n";
552552
Stream << "namespace automemcpy {\n";

libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ using llvm::libc_benchmarks::MemcpyConfiguration;
6363
using llvm::libc_benchmarks::MemmoveConfiguration;
6464
using llvm::libc_benchmarks::MemsetConfiguration;
6565
66-
namespace LIBC_NAMESPACE {
66+
namespace LIBC_NAMESPACE_DECL {
6767
6868
static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) {
6969
using namespace LIBC_NAMESPACE::x86;
@@ -134,7 +134,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) {
134134
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
135135
}
136136
137-
} // namespace LIBC_NAMESPACE
137+
} // namespace LIBC_NAMESPACE_DECL
138138
139139
namespace llvm {
140140
namespace automemcpy {

libc/benchmarks/gpu/BenchmarkLogger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <stdint.h>
1010

11-
namespace LIBC_NAMESPACE {
11+
namespace LIBC_NAMESPACE_DECL {
1212
namespace benchmarks {
1313

1414
// cpp::string_view specialization
@@ -94,4 +94,4 @@ template BenchmarkLogger &BenchmarkLogger::operator<< <UInt<320>>(UInt<320>);
9494
BenchmarkLogger log;
9595

9696
} // namespace benchmarks
97-
} // namespace LIBC_NAMESPACE
97+
} // namespace LIBC_NAMESPACE_DECL

libc/benchmarks/gpu/BenchmarkLogger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H
1010
#define LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H
1111

12-
namespace LIBC_NAMESPACE {
12+
namespace LIBC_NAMESPACE_DECL {
1313
namespace benchmarks {
1414

1515
// A class to log to standard output in the context of hermetic tests.
@@ -22,6 +22,6 @@ struct BenchmarkLogger {
2222
extern BenchmarkLogger log;
2323

2424
} // namespace benchmarks
25-
} // namespace LIBC_NAMESPACE
25+
} // namespace LIBC_NAMESPACE_DECL
2626

2727
#endif /* LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H */

libc/benchmarks/gpu/LibcGpuBenchmark.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "src/__support/fixedvector.h"
88
#include "src/time/gpu/time_utils.h"
99

10-
namespace LIBC_NAMESPACE {
10+
namespace LIBC_NAMESPACE_DECL {
1111
namespace benchmarks {
1212

1313
FixedVector<Benchmark *, 64> benchmarks;
@@ -136,4 +136,4 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
136136
};
137137

138138
} // namespace benchmarks
139-
} // namespace LIBC_NAMESPACE
139+
} // namespace LIBC_NAMESPACE_DECL

libc/benchmarks/gpu/LibcGpuBenchmark.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <stdint.h>
1212

13-
namespace LIBC_NAMESPACE {
13+
namespace LIBC_NAMESPACE_DECL {
1414

1515
namespace benchmarks {
1616

@@ -99,7 +99,7 @@ class Benchmark {
9999
const cpp::string_view get_name() const { return name; }
100100
};
101101
} // namespace benchmarks
102-
} // namespace LIBC_NAMESPACE
102+
} // namespace LIBC_NAMESPACE_DECL
103103

104104
#define BENCHMARK(SuiteName, TestName, Func) \
105105
LIBC_NAMESPACE::benchmarks::Benchmark SuiteName##_##TestName##_Instance( \

libc/benchmarks/gpu/timing/nvptx/timing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <stdint.h>
1818

19-
namespace LIBC_NAMESPACE {
19+
namespace LIBC_NAMESPACE_DECL {
2020

2121
// Returns the overhead associated with calling the profiling region. This
2222
// 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) {
9494

9595
return stop - start;
9696
}
97-
} // namespace LIBC_NAMESPACE
97+
} // namespace LIBC_NAMESPACE_DECL
9898

9999
#endif // LLVM_LIBC_UTILS_GPU_TIMING_NVPTX

libc/config/linux/app.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <stdint.h>
1515

16-
namespace LIBC_NAMESPACE {
16+
namespace LIBC_NAMESPACE_DECL {
1717

1818
// Data structure to capture properties of the linux/ELF TLS image.
1919
struct TLSImage {
@@ -104,6 +104,6 @@ void cleanup_tls(uintptr_t tls_addr, uintptr_t tls_size);
104104
// Set the thread pointer for the current thread.
105105
bool set_thread_ptr(uintptr_t val);
106106

107-
} // namespace LIBC_NAMESPACE
107+
} // namespace LIBC_NAMESPACE_DECL
108108

109109
#endif // LLVM_LIBC_CONFIG_LINUX_APP_H

libc/fuzzing/__support/hashtable_fuzz.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "src/__support/CPP/string_view.h"
1414
#include "src/__support/HashTable/table.h"
1515

16-
namespace LIBC_NAMESPACE {
16+
namespace LIBC_NAMESPACE_DECL {
1717

1818
// A fuzzing payload starts with
1919
// - uint16_t: initial capacity for table A
@@ -179,4 +179,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
179179
return 0;
180180
}
181181

182-
} // namespace LIBC_NAMESPACE
182+
} // namespace LIBC_NAMESPACE_DECL

libc/src/__support/CPP/algorithm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "src/__support/macros/attributes.h" // LIBC_INLINE
1616

17-
namespace LIBC_NAMESPACE {
17+
namespace LIBC_NAMESPACE_DECL {
1818
namespace cpp {
1919

2020
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) {
4141
}
4242

4343
} // namespace cpp
44-
} // namespace LIBC_NAMESPACE
44+
} // namespace LIBC_NAMESPACE_DECL
4545

4646
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H

libc/src/__support/CPP/array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "src/__support/macros/attributes.h"
1414
#include <stddef.h> // For size_t.
1515

16-
namespace LIBC_NAMESPACE {
16+
namespace LIBC_NAMESPACE_DECL {
1717
namespace cpp {
1818

1919
template <class T, size_t N> struct array {
@@ -74,6 +74,6 @@ template <class T, size_t N> struct array {
7474
};
7575

7676
} // namespace cpp
77-
} // namespace LIBC_NAMESPACE
77+
} // namespace LIBC_NAMESPACE_DECL
7878

7979
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ARRAY_H

libc/src/__support/CPP/atomic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "type_traits.h"
1616

17-
namespace LIBC_NAMESPACE {
17+
namespace LIBC_NAMESPACE_DECL {
1818
namespace cpp {
1919

2020
enum class MemoryOrder : int {
@@ -211,6 +211,6 @@ LIBC_INLINE void atomic_signal_fence([[maybe_unused]] MemoryOrder mem_ord) {
211211
}
212212

213213
} // namespace cpp
214-
} // namespace LIBC_NAMESPACE
214+
} // namespace LIBC_NAMESPACE_DECL
215215

216216
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ATOMIC_H

libc/src/__support/CPP/bit.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
#include <stdint.h>
2020

21-
namespace LIBC_NAMESPACE::cpp {
21+
namespace LIBC_NAMESPACE_DECL {
22+
namespace cpp {
2223

2324
#if __has_builtin(__builtin_memcpy_inline)
2425
#define LLVM_LIBC_HAS_BUILTIN_MEMCPY_INLINE
@@ -290,6 +291,7 @@ ADD_SPECIALIZATION(unsigned long long, __builtin_popcountll)
290291
#endif // __builtin_popcountg
291292
#undef ADD_SPECIALIZATION
292293

293-
} // namespace LIBC_NAMESPACE::cpp
294+
} // namespace cpp
295+
} // namespace LIBC_NAMESPACE_DECL
294296

295297
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BIT_H

libc/src/__support/CPP/bitset.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#include "src/__support/macros/attributes.h"
1313
#include <stddef.h> // For size_t.
1414

15-
namespace LIBC_NAMESPACE::cpp {
15+
namespace LIBC_NAMESPACE_DECL {
16+
namespace cpp {
1617

1718
template <size_t NumberOfBits> struct bitset {
1819
static_assert(NumberOfBits != 0,
@@ -86,6 +87,7 @@ template <size_t NumberOfBits> struct bitset {
8687
size_t Data[NUMBER_OF_UNITS] = {0};
8788
};
8889

89-
} // namespace LIBC_NAMESPACE::cpp
90+
} // namespace cpp
91+
} // namespace LIBC_NAMESPACE_DECL
9092

9193
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_BITSET_H

libc/src/__support/CPP/cstddef.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#include "src/__support/macros/attributes.h"
1313
#include "type_traits.h" // For enable_if_t, is_integral_v.
1414

15-
namespace LIBC_NAMESPACE::cpp {
15+
namespace LIBC_NAMESPACE_DECL {
16+
namespace cpp {
1617

1718
enum class byte : unsigned char {};
1819

@@ -66,6 +67,7 @@ to_integer(byte b) noexcept {
6667
return static_cast<IntegerType>(b);
6768
}
6869

69-
} // namespace LIBC_NAMESPACE::cpp
70+
} // namespace cpp
71+
} // namespace LIBC_NAMESPACE_DECL
7072

7173
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H

libc/src/__support/CPP/expected.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
#include "src/__support/macros/attributes.h"
1313

14-
namespace LIBC_NAMESPACE::cpp {
14+
namespace LIBC_NAMESPACE_DECL {
15+
namespace cpp {
1516

1617
// This is used to hold an unexpected value so that a different constructor is
1718
// selected.
@@ -52,6 +53,7 @@ template <class T, class E> class expected {
5253
LIBC_INLINE constexpr const T *operator->() const { return &exp; }
5354
};
5455

55-
} // namespace LIBC_NAMESPACE::cpp
56+
} // namespace cpp
57+
} // namespace LIBC_NAMESPACE_DECL
5658

5759
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_EXPECTED_H

libc/src/__support/CPP/functional.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <stdint.h>
2222

23-
namespace LIBC_NAMESPACE {
23+
namespace LIBC_NAMESPACE_DECL {
2424
namespace cpp {
2525

2626
/// A function type adapted from LLVM's function_ref.
@@ -65,6 +65,6 @@ template <typename Ret, typename... Params> class function<Ret(Params...)> {
6565
};
6666

6767
} // namespace cpp
68-
} // namespace LIBC_NAMESPACE
68+
} // namespace LIBC_NAMESPACE_DECL
6969

7070
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_FUNCTIONAL_H

libc/src/__support/CPP/iterator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "src/__support/CPP/type_traits/is_same.h"
1515
#include "src/__support/macros/attributes.h"
1616

17-
namespace LIBC_NAMESPACE {
17+
namespace LIBC_NAMESPACE_DECL {
1818
namespace cpp {
1919

2020
template <typename T> struct iterator_traits;
@@ -93,6 +93,6 @@ template <typename Iter> class reverse_iterator {
9393
};
9494

9595
} // namespace cpp
96-
} // namespace LIBC_NAMESPACE
96+
} // namespace LIBC_NAMESPACE_DECL
9797

9898
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_ITERATOR_H

libc/src/__support/CPP/limits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "src/__support/macros/attributes.h" // LIBC_INLINE
1616
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
1717

18-
namespace LIBC_NAMESPACE {
18+
namespace LIBC_NAMESPACE_DECL {
1919
namespace cpp {
2020

2121
namespace internal {
@@ -86,6 +86,6 @@ struct numeric_limits<__uint128_t>
8686
#endif
8787

8888
} // namespace cpp
89-
} // namespace LIBC_NAMESPACE
89+
} // namespace LIBC_NAMESPACE_DECL
9090

9191
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_LIMITS_H

libc/src/__support/CPP/mutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H
1010
#define LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H
1111

12-
namespace LIBC_NAMESPACE {
12+
namespace LIBC_NAMESPACE_DECL {
1313
namespace cpp {
1414

1515
// Assume the calling thread has already obtained mutex ownership.
@@ -44,6 +44,6 @@ template <typename MutexType> class lock_guard {
4444
template <typename T> lock_guard(T &) -> lock_guard<T>;
4545

4646
} // namespace cpp
47-
} // namespace LIBC_NAMESPACE
47+
} // namespace LIBC_NAMESPACE_DECL
4848

4949
#endif // LLVM_LIBC_SRC___SUPPORT_CPP_MUTEX_H

libc/src/__support/CPP/new.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ enum class align_val_t : size_t {};
2323

2424
} // namespace std
2525

26-
namespace LIBC_NAMESPACE {
26+
namespace LIBC_NAMESPACE_DECL {
2727

2828
class AllocChecker {
2929
bool success = false;
@@ -52,7 +52,7 @@ class AllocChecker {
5252
}
5353
};
5454

55-
} // namespace LIBC_NAMESPACE
55+
} // namespace LIBC_NAMESPACE_DECL
5656

5757
LIBC_INLINE void *operator new(size_t size,
5858
LIBC_NAMESPACE::AllocChecker &ac) noexcept {

0 commit comments

Comments
 (0)