Skip to content

Commit 3e04ad4

Browse files
committed
[ORC-RT] Remove double underscore from the orc_rt namespace.
We should use `orc_rt` as the public C++ API namespace for the ORC runtime and control symbol visibility to hide implementation details, rather than rely on the '__' prefix.
1 parent d5f6f30 commit 3e04ad4

24 files changed

+64
-67
lines changed

compiler-rt/lib/orc/adt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <ostream>
1919
#include <string>
2020

21-
namespace __orc_rt {
21+
namespace orc_rt {
2222

2323
constexpr std::size_t dynamic_extent = std::numeric_limits<std::size_t>::max();
2424

@@ -58,6 +58,6 @@ template <typename T, std::size_t Extent = dynamic_extent> class span {
5858
size_type Size = 0;
5959
};
6060

61-
} // end namespace __orc_rt
61+
} // namespace orc_rt
6262

6363
#endif // ORC_RT_ADT_H

compiler-rt/lib/orc/bitmask_enum.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <cassert>
1919
#include <type_traits>
2020

21-
namespace __orc_rt {
21+
namespace orc_rt {
2222

2323
/// ORC_RT_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you
2424
/// can perform bitwise operations on it without putting static_cast everywhere.
@@ -146,6 +146,6 @@ E &operator^=(E &LHS, E RHS) {
146146
return LHS;
147147
}
148148

149-
} // end namespace __orc_rt
149+
} // namespace orc_rt
150150

151151
#endif // ORC_RT_BITMASK_ENUM_H

compiler-rt/lib/orc/coff_platform.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
#define DEBUG_TYPE "coff_platform"
3131

32-
using namespace __orc_rt;
32+
using namespace orc_rt;
3333

34-
namespace __orc_rt {
34+
namespace orc_rt {
3535

3636
using COFFJITDylibDepInfo = std::vector<ExecutorAddr>;
3737
using COFFJITDylibDepInfoMap =
@@ -45,7 +45,7 @@ using SPSCOFFJITDylibDepInfo = SPSSequence<SPSExecutorAddr>;
4545
using SPSCOFFJITDylibDepInfoMap =
4646
SPSSequence<SPSTuple<SPSExecutorAddr, SPSCOFFJITDylibDepInfo>>;
4747

48-
} // namespace __orc_rt
48+
} // namespace orc_rt
4949

5050
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_coff_symbol_lookup_tag)
5151
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_coff_push_initializers_tag)
@@ -752,7 +752,7 @@ ORC_RT_INTERFACE int64_t __orc_rt_coff_run_program(const char *JITDylibName,
752752
using MainTy = int (*)(int, char *[]);
753753

754754
void *H =
755-
__orc_rt_coff_jit_dlopen(JITDylibName, __orc_rt::coff::ORC_RT_RTLD_LAZY);
755+
__orc_rt_coff_jit_dlopen(JITDylibName, orc_rt::coff::ORC_RT_RTLD_LAZY);
756756
if (!H) {
757757
__orc_rt_log_error(__orc_rt_coff_jit_dlerror());
758758
return -1;

compiler-rt/lib/orc/coff_platform.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ORC_RT_INTERFACE int __orc_rt_coff_jit_dlclose(void *header);
2323
ORC_RT_INTERFACE void *__orc_rt_coff_jit_dlsym(void *header,
2424
const char *symbol);
2525

26-
namespace __orc_rt {
26+
namespace orc_rt {
2727
namespace coff {
2828

2929
enum dlopen_mode : int {
@@ -33,7 +33,7 @@ enum dlopen_mode : int {
3333
ORC_RT_RTLD_GLOBAL = 0x8
3434
};
3535

36-
} // end namespace coff
37-
} // end namespace __orc_rt
36+
} // namespace coff
37+
} // namespace orc_rt
3838

3939
#endif

compiler-rt/lib/orc/debug.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
#include <cstdlib>
1919
#include <cstring>
2020

21-
22-
namespace __orc_rt {
21+
namespace orc_rt {
2322

2423
#ifndef NDEBUG
2524

@@ -80,4 +79,4 @@ void printdbg(const char *format, ...) {
8079

8180
#endif // !NDEBUG
8281

83-
} // end namespace __orc_rt
82+
} // namespace orc_rt

compiler-rt/lib/orc/debug.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#ifndef NDEBUG
1919

20-
namespace __orc_rt {
20+
namespace orc_rt {
2121

2222
extern std::atomic<const char *> DebugTypes;
2323
extern char DebugTypesAll;
@@ -27,18 +27,16 @@ const char *initializeDebug();
2727
bool debugTypeEnabled(const char *Type, const char *Types);
2828
void printdbg(const char *format, ...);
2929

30-
} // namespace __orc_rt
30+
} // namespace orc_rt
3131

3232
#define ORC_RT_DEBUG_WITH_TYPE(TYPE, X) \
3333
do { \
34-
const char *Types = \
35-
::__orc_rt::DebugTypes.load(std::memory_order_relaxed); \
34+
const char *Types = ::orc_rt::DebugTypes.load(std::memory_order_relaxed); \
3635
if (!Types) \
3736
Types = initializeDebug(); \
3837
if (Types == &DebugTypesNone) \
3938
break; \
40-
if (Types == &DebugTypesAll || \
41-
::__orc_rt::debugTypeEnabled(TYPE, Types)) { \
39+
if (Types == &DebugTypesAll || ::orc_rt::debugTypeEnabled(TYPE, Types)) { \
4240
X; \
4341
} \
4442
} while (false)

compiler-rt/lib/orc/dlfcn_wrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <vector>
1818

19-
using namespace __orc_rt;
19+
using namespace orc_rt;
2020

2121
extern "C" const char *__orc_rt_jit_dlerror();
2222
extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);

compiler-rt/lib/orc/elfnix_platform.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <unordered_map>
2525
#include <vector>
2626

27-
using namespace __orc_rt;
28-
using namespace __orc_rt::elfnix;
27+
using namespace orc_rt;
28+
using namespace orc_rt::elfnix;
2929

3030
// Declare function tags for functions in the JIT process.
3131
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_elfnix_get_initializers_tag)
@@ -601,7 +601,7 @@ ORC_RT_INTERFACE int64_t __orc_rt_elfnix_run_program(
601601
using MainTy = int (*)(int, char *[]);
602602

603603
void *H = __orc_rt_elfnix_jit_dlopen(JITDylibName,
604-
__orc_rt::elfnix::ORC_RT_RTLD_LAZY);
604+
orc_rt::elfnix::ORC_RT_RTLD_LAZY);
605605
if (!H) {
606606
__orc_rt_log_error(__orc_rt_elfnix_jit_dlerror());
607607
return -1;

compiler-rt/lib/orc/elfnix_platform.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ORC_RT_INTERFACE int __orc_rt_elfnix_jit_dlclose(void *dso_handle);
2929
ORC_RT_INTERFACE void *__orc_rt_elfnix_jit_dlsym(void *dso_handle,
3030
const char *symbol);
3131

32-
namespace __orc_rt {
32+
namespace orc_rt {
3333
namespace elfnix {
3434

3535
struct ELFNixPerObjectSectionsToRegister {
@@ -65,7 +65,7 @@ enum dlopen_mode : int {
6565
ORC_RT_RTLD_GLOBAL = 0x8
6666
};
6767

68-
} // end namespace elfnix
68+
} // namespace elfnix
6969

7070
using SPSELFNixPerObjectSectionsToRegister =
7171
SPSTuple<SPSExecutorAddrRange, SPSExecutorAddrRange>;
@@ -126,6 +126,6 @@ class SPSSerializationTraits<SPSELFNixJITDylibInitializers,
126126
}
127127
};
128128

129-
} // end namespace __orc_rt
129+
} // namespace orc_rt
130130

131131
#endif // ORC_RT_ELFNIX_PLATFORM_H

compiler-rt/lib/orc/endianness.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#endif
4747
#endif
4848

49-
namespace __orc_rt {
49+
namespace orc_rt {
5050

5151
/// ByteSwap_16 - This function returns a byte-swapped representation of
5252
/// the 16-bit argument.
@@ -138,6 +138,6 @@ template <typename T> inline void swapByteOrder(T &Value) {
138138
Value = getSwappedBytes(Value);
139139
}
140140

141-
} // end namespace __orc_rt
141+
} // namespace orc_rt
142142

143143
#endif // ORC_RT_ENDIAN_H

compiler-rt/lib/orc/error.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <string>
1919
#include <type_traits>
2020

21-
namespace __orc_rt {
21+
namespace orc_rt {
2222

2323
/// Base class for all errors.
2424
class ErrorInfoBase : public RTTIExtends<ErrorInfoBase, RTTIRoot> {
@@ -421,6 +421,6 @@ class StringError : public RTTIExtends<StringError, ErrorInfoBase> {
421421
std::string ErrMsg;
422422
};
423423

424-
} // end namespace __orc_rt
424+
} // namespace orc_rt
425425

426426
#endif // ORC_RT_ERROR_H

compiler-rt/lib/orc/executor_address.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
#include <cassert>
2323
#include <type_traits>
2424

25-
namespace __orc_rt {
25+
namespace orc_rt {
2626

2727
using ExecutorAddrDiff = uint64_t;
2828

2929
/// Represents an address in the executor process.
3030
class ExecutorAddr {
3131
public:
3232
/// A wrap/unwrap function that leaves pointers unmodified.
33-
template <typename T> using rawPtr = __orc_rt::identity<T *>;
33+
template <typename T> using rawPtr = orc_rt::identity<T *>;
3434

3535
/// Default wrap function to use on this host.
3636
template <typename T> using defaultWrap = rawPtr<T>;
@@ -247,13 +247,13 @@ class SPSSerializationTraits<SPSExecutorAddrRange, ExecutorAddrRange> {
247247

248248
using SPSExecutorAddrRangeSequence = SPSSequence<SPSExecutorAddrRange>;
249249

250-
} // End namespace __orc_rt
250+
} // End namespace orc_rt
251251

252252
namespace std {
253253

254254
// Make ExecutorAddr hashable.
255-
template <> struct hash<__orc_rt::ExecutorAddr> {
256-
size_t operator()(const __orc_rt::ExecutorAddr &A) const {
255+
template <> struct hash<orc_rt::ExecutorAddr> {
256+
size_t operator()(const orc_rt::ExecutorAddr &A) const {
257257
return hash<uint64_t>()(A.getValue());
258258
}
259259
};

compiler-rt/lib/orc/executor_symbol_def.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "executor_address.h"
2121
#include "simple_packed_serialization.h"
2222

23-
namespace __orc_rt {
23+
namespace orc_rt {
2424

2525
/// Flags for symbols in the JIT.
2626
class JITSymbolFlags {
@@ -146,6 +146,6 @@ class SPSSerializationTraits<SPSExecutorSymbolDef, ExecutorSymbolDef> {
146146
}
147147
};
148148

149-
} // End namespace __orc_rt
149+
} // End namespace orc_rt
150150

151151
#endif // ORC_RT_EXECUTOR_SYMBOL_DEF_H

compiler-rt/lib/orc/extensible_rtti.cpp

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

1717
#include "extensible_rtti.h"
1818

19-
namespace __orc_rt {
19+
namespace orc_rt {
2020

2121
char RTTIRoot::ID = 0;
2222
void RTTIRoot::anchor() {}
2323

24-
} // end namespace __orc_rt
24+
} // namespace orc_rt

compiler-rt/lib/orc/extensible_rtti.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#ifndef ORC_RT_EXTENSIBLE_RTTI_H
6060
#define ORC_RT_EXTENSIBLE_RTTI_H
6161

62-
namespace __orc_rt {
62+
namespace orc_rt {
6363

6464
template <typename ThisT, typename ParentT> class RTTIExtends;
6565

@@ -140,6 +140,6 @@ template <typename To, typename From> bool isa(const From &Value) {
140140
return To::classof(&Value);
141141
}
142142

143-
} // end namespace __orc_rt
143+
} // namespace orc_rt
144144

145145
#endif // ORC_RT_EXTENSIBLE_RTTI_H

compiler-rt/lib/orc/interval_map.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <cassert>
1818
#include <map>
1919

20-
namespace __orc_rt {
20+
namespace orc_rt {
2121

2222
enum class IntervalCoalescing { Enabled, Disabled };
2323

@@ -163,6 +163,6 @@ class IntervalMap<KeyT, ValT, IntervalCoalescing::Disabled>
163163
}
164164
};
165165

166-
} // End namespace __orc_rt
166+
} // End namespace orc_rt
167167

168168
#endif // ORC_RT_INTERVAL_MAP_H

compiler-rt/lib/orc/interval_set.h

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

1616
#include "interval_map.h"
1717

18-
namespace __orc_rt {
18+
namespace orc_rt {
1919

2020
/// Implements a coalescing interval set.
2121
///
@@ -82,6 +82,6 @@ class IntervalSet {
8282
ImplMap Map;
8383
};
8484

85-
} // End namespace __orc_rt
85+
} // End namespace orc_rt
8686

8787
#endif // ORC_RT_INTERVAL_SET_H

compiler-rt/lib/orc/macho_platform.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
#define DEBUG_TYPE "macho_platform"
3232

33-
using namespace __orc_rt;
34-
using namespace __orc_rt::macho;
33+
using namespace orc_rt;
34+
using namespace orc_rt::macho;
3535

3636
// Declare function tags for functions in the JIT process.
3737
ORC_RT_JIT_DISPATCH_TAG(__orc_rt_macho_push_initializers_tag)
@@ -82,7 +82,7 @@ using MachOJITDylibDepInfoMap =
8282

8383
} // anonymous namespace
8484

85-
namespace __orc_rt {
85+
namespace orc_rt {
8686

8787
using SPSMachOObjectPlatformSectionsMap =
8888
SPSSequence<SPSTuple<SPSString, SPSExecutorAddrRange>>;
@@ -139,7 +139,7 @@ class SPSSerializationTraits<SPSUnwindSectionInfo, UnwindSectionInfo> {
139139
}
140140
};
141141

142-
} // namespace __orc_rt
142+
} // namespace orc_rt
143143

144144
namespace {
145145
struct TLVDescriptor {
@@ -406,7 +406,7 @@ class MachOPlatformRuntimeState {
406406

407407
} // anonymous namespace
408408

409-
namespace __orc_rt {
409+
namespace orc_rt {
410410

411411
class SPSMachOExecutorSymbolFlags;
412412

@@ -441,7 +441,7 @@ class SPSSerializationTraits<
441441
}
442442
};
443443

444-
} // namespace __orc_rt
444+
} // namespace orc_rt
445445

446446
namespace {
447447

@@ -1532,8 +1532,8 @@ ORC_RT_INTERFACE int64_t __orc_rt_macho_run_program(const char *JITDylibName,
15321532
int argc, char *argv[]) {
15331533
using MainTy = int (*)(int, char *[]);
15341534

1535-
void *H = __orc_rt_macho_jit_dlopen(JITDylibName,
1536-
__orc_rt::macho::ORC_RT_RTLD_LAZY);
1535+
void *H =
1536+
__orc_rt_macho_jit_dlopen(JITDylibName, orc_rt::macho::ORC_RT_RTLD_LAZY);
15371537
if (!H) {
15381538
__orc_rt_log_error(__orc_rt_macho_jit_dlerror());
15391539
return -1;

0 commit comments

Comments
 (0)