mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-13 06:28:52 +03:00
fix building against recent LLVM 4.0
This commit is contained in:
parent
47e1251298
commit
8f0f29c239
3 changed files with 20 additions and 4 deletions
|
@ -66,6 +66,9 @@ static bool ReadPathFromRegistry(llvm::SmallString<128> &p) {
|
||||||
if (RegGetValue(hkey, NULL, _T("Path"), RRF_RT_REG_SZ, NULL, data, &length) ==
|
if (RegGetValue(hkey, NULL, _T("Path"), RRF_RT_REG_SZ, NULL, data, &length) ==
|
||||||
ERROR_SUCCESS) {
|
ERROR_SUCCESS) {
|
||||||
#if UNICODE
|
#if UNICODE
|
||||||
|
#if LDC_LLVM_VER >= 400
|
||||||
|
using UTF16 = llvm::UTF16;
|
||||||
|
#endif
|
||||||
std::string out;
|
std::string out;
|
||||||
res = llvm::convertUTF16ToUTF8String(
|
res = llvm::convertUTF16ToUTF8String(
|
||||||
llvm::ArrayRef<UTF16>(reinterpret_cast<UTF16 *>(data), length), out);
|
llvm::ArrayRef<UTF16>(reinterpret_cast<UTF16 *>(data), length), out);
|
||||||
|
|
|
@ -87,18 +87,28 @@ public:
|
||||||
|
|
||||||
// Implement virtual functions needed by generic_parser_base
|
// Implement virtual functions needed by generic_parser_base
|
||||||
unsigned getNumOptions() const LLVM_OVERRIDE { return 1; }
|
unsigned getNumOptions() const LLVM_OVERRIDE { return 1; }
|
||||||
const char *getOption(unsigned N) const LLVM_OVERRIDE {
|
#if LDC_LLVM_VER >= 400
|
||||||
|
llvm::StringRef
|
||||||
|
#else
|
||||||
|
const char *
|
||||||
|
#endif
|
||||||
|
getOption(unsigned N) const LLVM_OVERRIDE {
|
||||||
assert(N == 0);
|
assert(N == 0);
|
||||||
#if LDC_LLVM_VER >= 308
|
#if LDC_LLVM_VER >= 308 && LDC_LLVM_VER < 400
|
||||||
return owner().ArgStr.data();
|
return owner().ArgStr.data();
|
||||||
#else
|
#else
|
||||||
return owner().ArgStr;
|
return owner().ArgStr;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getDescription(unsigned N) const LLVM_OVERRIDE {
|
#if LDC_LLVM_VER >= 400
|
||||||
|
llvm::StringRef
|
||||||
|
#else
|
||||||
|
const char *
|
||||||
|
#endif
|
||||||
|
getDescription(unsigned N) const LLVM_OVERRIDE {
|
||||||
assert(N == 0);
|
assert(N == 0);
|
||||||
#if LDC_LLVM_VER >= 308
|
#if LDC_LLVM_VER >= 308 && LDC_LLVM_VER < 400
|
||||||
return owner().HelpStr.data();
|
return owner().HelpStr.data();
|
||||||
#else
|
#else
|
||||||
return owner().HelpStr;
|
return owner().HelpStr;
|
||||||
|
|
|
@ -1375,6 +1375,9 @@ bool isLLVMUnsigned(Type *t) { return t->isunsigned() || t->ty == Tpointer; }
|
||||||
void printLabelName(std::ostream &target, const char *func_mangle,
|
void printLabelName(std::ostream &target, const char *func_mangle,
|
||||||
const char *label_name) {
|
const char *label_name) {
|
||||||
target << gTargetMachine->getMCAsmInfo()->getPrivateGlobalPrefix()
|
target << gTargetMachine->getMCAsmInfo()->getPrivateGlobalPrefix()
|
||||||
|
#if LDC_LLVM_VER >= 400
|
||||||
|
.str()
|
||||||
|
#endif
|
||||||
<< func_mangle << "_" << label_name;
|
<< func_mangle << "_" << label_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue