runtime: namespace LLVMSupport fork

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.
This commit is contained in:
Saleem Abdulrasool
2020-05-11 09:29:25 -07:00
committed by Saleem Abdulrasool
parent 3fa1d1fe3f
commit b72788c27a
118 changed files with 328 additions and 84 deletions

View File

@@ -17,6 +17,7 @@
#include "llvm/Support/Compiler.h"
#include <string>
inline namespace __swift { inline namespace __runtime {
namespace llvm {
class StringRef;
class Twine;
@@ -122,6 +123,7 @@ LLVM_ATTRIBUTE_NORETURN void
llvm_unreachable_internal(const char *msg = nullptr, const char *file = nullptr,
unsigned line = 0);
}
}} // namespace swift::runtime
/// Marks that the current location is not supposed to be reachable.
/// In !NDEBUG builds, prints the message and location info to stderr.
@@ -133,11 +135,11 @@ llvm_unreachable_internal(const char *msg = nullptr, const char *file = nullptr,
/// allows compilers to omit some unnecessary code.
#ifndef NDEBUG
#define llvm_unreachable(msg) \
::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__)
__swift::__runtime::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__)
#elif defined(LLVM_BUILTIN_UNREACHABLE)
#define llvm_unreachable(msg) LLVM_BUILTIN_UNREACHABLE
#else
#define llvm_unreachable(msg) ::llvm::llvm_unreachable_internal()
#define llvm_unreachable(msg) __swift::__runtime::llvm::llvm_unreachable_internal()
#endif
#endif