Skip to content

Commit 3f30eff

Browse files
authored
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)
This is a part of #97655.
1 parent 2d7e136 commit 3f30eff

File tree

2,327 files changed

+7567
-4678
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,327 files changed

+7567
-4678
lines changed

libc/benchmarks/LibcDefaultImplementations.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#include "LibcFunctionPrototypes.h"
2+
#include "src/__support/macros/config.h"
23
#include "llvm/ADT/ArrayRef.h"
34
#include <cstddef>
45

5-
namespace LIBC_NAMESPACE {
6+
namespace LIBC_NAMESPACE_DECL {
67

78
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
89
extern void *memmove(void *, const void *, size_t);
@@ -11,7 +12,7 @@ extern void bzero(void *, size_t);
1112
extern int memcmp(const void *, const void *, size_t);
1213
extern int bcmp(const void *, const void *, size_t);
1314

14-
} // namespace LIBC_NAMESPACE
15+
} // namespace LIBC_NAMESPACE_DECL
1516

1617
// List of implementations to test.
1718

libc/benchmarks/LibcMemoryBenchmarkMain.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "LibcBenchmark.h"
1111
#include "LibcMemoryBenchmark.h"
1212
#include "MemorySizeDistributions.h"
13+
#include "src/__support/macros/config.h"
1314
#include "llvm/Support/CommandLine.h"
1415
#include "llvm/Support/ErrorHandling.h"
1516
#include "llvm/Support/FileSystem.h"
@@ -21,7 +22,7 @@
2122
#include <cstring>
2223
#include <unistd.h>
2324

24-
namespace LIBC_NAMESPACE {
25+
namespace LIBC_NAMESPACE_DECL {
2526

2627
extern void *memcpy(void *__restrict, const void *__restrict, size_t);
2728
extern void *memmove(void *, const void *, size_t);
@@ -30,7 +31,7 @@ extern void bzero(void *, size_t);
3031
extern int memcmp(const void *, const void *, size_t);
3132
extern int bcmp(const void *, const void *, size_t);
3233

33-
} // namespace LIBC_NAMESPACE
34+
} // namespace LIBC_NAMESPACE_DECL
3435

3536
namespace llvm {
3637
namespace libc_benchmarks {

libc/benchmarks/automemcpy/lib/CodeGen.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
// function at the end of the file.
3737

3838
#include "automemcpy/CodeGen.h"
39+
#include "src/__support/macros/config.h"
3940
#include <cassert>
4041
#include <llvm/ADT/STLExtras.h>
4142
#include <llvm/ADT/StringSet.h>
@@ -542,11 +543,11 @@ static void Serialize(raw_ostream &Stream,
542543
Stream << "using llvm::libc_benchmarks::MemmoveConfiguration;\n";
543544
Stream << "using llvm::libc_benchmarks::MemsetConfiguration;\n";
544545
Stream << "\n";
545-
Stream << "namespace LIBC_NAMESPACE {\n";
546+
Stream << "namespace LIBC_NAMESPACE_DECL {\n";
546547
Stream << "\n";
547548
codegen::functions::Serialize(Stream, Descriptors);
548549
Stream << "\n";
549-
Stream << "} // namespace LIBC_NAMESPACE\n";
550+
Stream << "} // namespace LIBC_NAMESPACE_DECL\n";
550551
Stream << "\n";
551552
Stream << "namespace llvm {\n";
552553
Stream << "namespace automemcpy {\n";

libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp

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

99
#include "automemcpy/CodeGen.h"
1010
#include "automemcpy/RandomFunctionGenerator.h"
11+
#include "src/__support/macros/config.h"
1112
#include "gmock/gmock.h"
1213
#include "gtest/gtest.h"
1314
#include <optional>
@@ -63,7 +64,7 @@ using llvm::libc_benchmarks::MemcpyConfiguration;
6364
using llvm::libc_benchmarks::MemmoveConfiguration;
6465
using llvm::libc_benchmarks::MemsetConfiguration;
6566
66-
namespace LIBC_NAMESPACE {
67+
namespace LIBC_NAMESPACE_DECL {
6768
6869
static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) {
6970
using namespace LIBC_NAMESPACE::x86;
@@ -134,7 +135,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) {
134135
return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size);
135136
}
136137
137-
} // namespace LIBC_NAMESPACE
138+
} // namespace LIBC_NAMESPACE_DECL
138139
139140
namespace llvm {
140141
namespace automemcpy {

libc/benchmarks/gpu/BenchmarkLogger.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
#include "src/__support/CPP/string_view.h"
44
#include "src/__support/OSUtil/io.h" // write_to_stderr
55
#include "src/__support/big_int.h" // is_big_int
6+
#include "src/__support/macros/config.h"
67
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
78
#include "src/__support/uint128.h"
89

910
#include <stdint.h>
1011

11-
namespace LIBC_NAMESPACE {
12+
namespace LIBC_NAMESPACE_DECL {
1213
namespace benchmarks {
1314

1415
// cpp::string_view specialization
@@ -94,4 +95,4 @@ template BenchmarkLogger &BenchmarkLogger::operator<< <UInt<320>>(UInt<320>);
9495
BenchmarkLogger log;
9596

9697
} // namespace benchmarks
97-
} // namespace LIBC_NAMESPACE
98+
} // namespace LIBC_NAMESPACE_DECL

libc/benchmarks/gpu/BenchmarkLogger.h

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

12-
namespace LIBC_NAMESPACE {
12+
#include "src/__support/macros/config.h"
13+
14+
namespace LIBC_NAMESPACE_DECL {
1315
namespace benchmarks {
1416

1517
// A class to log to standard output in the context of hermetic tests.
@@ -22,6 +24,6 @@ struct BenchmarkLogger {
2224
extern BenchmarkLogger log;
2325

2426
} // namespace benchmarks
25-
} // namespace LIBC_NAMESPACE
27+
} // namespace LIBC_NAMESPACE_DECL
2628

2729
#endif /* LLVM_LIBC_BENCHMARKS_GPU_BENCHMARKLOGGER_H */

libc/benchmarks/gpu/LibcGpuBenchmark.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
#include "src/__support/FPUtil/sqrt.h"
66
#include "src/__support/GPU/utils.h"
77
#include "src/__support/fixedvector.h"
8+
#include "src/__support/macros/config.h"
89
#include "src/time/gpu/time_utils.h"
910

10-
namespace LIBC_NAMESPACE {
11+
namespace LIBC_NAMESPACE_DECL {
1112
namespace benchmarks {
1213

1314
FixedVector<Benchmark *, 64> benchmarks;
@@ -135,4 +136,4 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
135136
};
136137

137138
} // namespace benchmarks
138-
} // namespace LIBC_NAMESPACE
139+
} // namespace LIBC_NAMESPACE_DECL

libc/benchmarks/gpu/LibcGpuBenchmark.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
#include "src/__support/CPP/functional.h"
77
#include "src/__support/CPP/limits.h"
88
#include "src/__support/CPP/string_view.h"
9+
#include "src/__support/macros/config.h"
910
#include "src/time/clock.h"
1011

1112
#include <stdint.h>
1213

13-
namespace LIBC_NAMESPACE {
14+
namespace LIBC_NAMESPACE_DECL {
1415

1516
namespace benchmarks {
1617

@@ -99,7 +100,7 @@ class Benchmark {
99100
const cpp::string_view get_name() const { return name; }
100101
};
101102
} // namespace benchmarks
102-
} // namespace LIBC_NAMESPACE
103+
} // namespace LIBC_NAMESPACE_DECL
103104

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

libc/benchmarks/gpu/timing/amdgpu/timing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
else \
2626
asm("" ::"v"(VARIABLE))
2727

28-
namespace LIBC_NAMESPACE {
28+
namespace LIBC_NAMESPACE_DECL {
2929

3030
// Returns the overhead associated with calling the profiling region. This
3131
// allows us to substract the constant-time overhead from the latency to
@@ -107,6 +107,6 @@ template <typename F, typename T1, typename T2>
107107
return stop - start;
108108
}
109109

110-
} // namespace LIBC_NAMESPACE
110+
} // namespace LIBC_NAMESPACE_DECL
111111

112112
#endif // LLVM_LIBC_UTILS_GPU_TIMING_AMDGPU

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

0 commit comments

Comments
 (0)