Skip to content

Commit 5ae5ce1

Browse files
compnerdkubamracek
authored andcommitted
[LLVMSupport] Re-namespace the LLVMSupport fork after re-forking by re-applying b72788c
More precisely: 1) git cherry-pick b72788c 2) manually resolve the conflict in AlignOf.h by keeping the HEAD's version of the chunk and discarding the cherry-pick's change 3) git add AlignOf.h 4) git status | grep "deleted by us" | awk '{print($4)}' | xargs git rm 5) git cherry-pick --continue Original namespacing commit message: > This adds the `__swift::__runtime` inline namespace to the LLVMSupport > interfaces. This avoids an ODR violation when LLVM and Swift are in the > same address space. It also will aid in the process of pruning the > LLVMSupport library by ensuring that accidental leakage of the llvm > namespace does not allow us to remove symbols which we rely on.
1 parent 5193a76 commit 5ae5ce1

34 files changed

+110
-34
lines changed

stdlib/include/llvm/ADT/ArrayRef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <type_traits>
2525
#include <vector>
2626

27+
inline namespace __swift { inline namespace __runtime {
2728
namespace llvm {
2829

2930
template<typename T> struct DenseMapInfo;
@@ -601,5 +602,6 @@ namespace llvm {
601602
};
602603

603604
} // end namespace llvm
605+
}} // namespace swift::runtime
604606

605607
#endif // LLVM_ADT_ARRAYREF_H

stdlib/include/llvm/ADT/DenseMap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <type_traits>
3232
#include <utility>
3333

34+
inline namespace __swift { inline namespace __runtime {
3435
namespace llvm {
3536

3637
namespace detail {
@@ -1304,5 +1305,6 @@ inline size_t capacity_in_bytes(const DenseMap<KeyT, ValueT, KeyInfoT> &X) {
13041305
}
13051306

13061307
} // end namespace llvm
1308+
}} // namespace swift::runtime
13071309

13081310
#endif // LLVM_ADT_DENSEMAP_H

stdlib/include/llvm/ADT/DenseMapInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <tuple>
2121
#include <utility>
2222

23+
inline namespace __swift { inline namespace __runtime {
2324
namespace llvm {
2425

2526
namespace detail {
@@ -291,5 +292,6 @@ template <> struct DenseMapInfo<hash_code> {
291292
};
292293

293294
} // end namespace llvm
295+
}} // namespace swift::runtime
294296

295297
#endif // LLVM_ADT_DENSEMAPINFO_H

stdlib/include/llvm/ADT/DenseSet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <iterator>
2424
#include <utility>
2525

26+
inline namespace __swift { inline namespace __runtime {
2627
namespace llvm {
2728

2829
namespace detail {
@@ -298,5 +299,6 @@ class SmallDenseSet
298299
};
299300

300301
} // end namespace llvm
302+
}} // namespace swift::runtime
301303

302304
#endif // LLVM_ADT_DENSESET_H

stdlib/include/llvm/ADT/Hashing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include <tuple>
5656
#include <utility>
5757

58+
inline namespace __swift { inline namespace __runtime {
5859
namespace llvm {
5960

6061
/// An opaque object representing a hash code.
@@ -678,5 +679,6 @@ hash_code hash_value(const std::basic_string<T> &arg) {
678679
}
679680

680681
} // namespace llvm
682+
}} // namespace swift::runtime
681683

682684
#endif

stdlib/include/llvm/ADT/None.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
#ifndef LLVM_ADT_NONE_H
1616
#define LLVM_ADT_NONE_H
1717

18+
inline namespace __swift { inline namespace __runtime {
1819
namespace llvm {
1920
/// A simple null object to allow implicit construction of Optional<T>
2021
/// and similar types without having to spell out the specialization's name.
2122
// (constant value 1 in an attempt to workaround MSVC build issue... )
2223
enum class NoneType { None = 1 };
2324
const NoneType None = NoneType::None;
2425
}
26+
}} // swift::runtime
2527

2628
#endif

stdlib/include/llvm/ADT/Optional.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <new>
2626
#include <utility>
2727

28+
inline namespace __swift { inline namespace __runtime {
2829
namespace llvm {
2930

3031
class raw_ostream;
@@ -492,5 +493,6 @@ raw_ostream &operator<<(raw_ostream &OS, const Optional<T> &O) {
492493
}
493494

494495
} // end namespace llvm
496+
}} // namespace swift::runtime
495497

496498
#endif // LLVM_ADT_OPTIONAL_H

stdlib/include/llvm/ADT/PointerIntPair.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <cstdint>
2121
#include <limits>
2222

23+
inline namespace __swift { inline namespace __runtime {
2324
namespace llvm {
2425

2526
template <typename T> struct DenseMapInfo;
@@ -240,5 +241,6 @@ struct PointerLikeTypeTraits<
240241
};
241242

242243
} // end namespace llvm
244+
}} // namespace swift::runtime
243245

244246
#endif // LLVM_ADT_POINTERINTPAIR_H

stdlib/include/llvm/ADT/PointerUnion.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <cstddef>
2222
#include <cstdint>
2323

24+
inline namespace __swift { inline namespace __runtime {
2425
namespace llvm {
2526

2627
template <typename T> struct PointerUnionTypeSelectorReturn {
@@ -288,5 +289,6 @@ template <typename ...PTs> struct DenseMapInfo<PointerUnion<PTs...>> {
288289
};
289290

290291
} // end namespace llvm
292+
}} // swift::runtime
291293

292294
#endif // LLVM_ADT_POINTERUNION_H

stdlib/include/llvm/ADT/STLExtras.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <random> // for std::mt19937
4141
#endif
4242

43+
inline namespace __swift { inline namespace __runtime {
4344
namespace llvm {
4445

4546
// Only used by compiler if both template types are the same. Useful when
@@ -2067,5 +2068,6 @@ template <class Ptr> auto to_address(const Ptr &P) { return P.operator->(); }
20672068
template <class T> constexpr T *to_address(T *P) { return P; }
20682069

20692070
} // end namespace llvm
2071+
}} // namespace swift::runtime
20702072

20712073
#endif // LLVM_ADT_STLEXTRAS_H

0 commit comments

Comments
 (0)