[pkg-d-commits] [ldc] 49/211: fix building against recent LLVM 4.0

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:08 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit 8f0f29c239e54e28960cb6586f96b90ad5e1528c
Author: Rainer Schuetze <r.sagitario at gmx.de>
Date:   Mon Oct 3 10:26:24 2016 +0200

    fix building against recent LLVM 4.0
---
 driver/configfile.cpp |  3 +++
 gen/cl_helpers.h      | 18 ++++++++++++++----
 gen/llvmhelpers.cpp   |  3 +++
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/driver/configfile.cpp b/driver/configfile.cpp
index 15f1955..9e33884 100644
--- a/driver/configfile.cpp
+++ b/driver/configfile.cpp
@@ -66,6 +66,9 @@ static bool ReadPathFromRegistry(llvm::SmallString<128> &p) {
       if (RegGetValue(hkey, NULL, _T("Path"), RRF_RT_REG_SZ, NULL, data, &length) ==
           ERROR_SUCCESS) {
 #if UNICODE
+#if LDC_LLVM_VER >= 400
+        using UTF16 = llvm::UTF16;
+#endif
         std::string out;
         res = llvm::convertUTF16ToUTF8String(
             llvm::ArrayRef<UTF16>(reinterpret_cast<UTF16 *>(data), length), out);
diff --git a/gen/cl_helpers.h b/gen/cl_helpers.h
index 64e522c..91bbc1b 100644
--- a/gen/cl_helpers.h
+++ b/gen/cl_helpers.h
@@ -87,18 +87,28 @@ public:
 
   // Implement virtual functions needed by generic_parser_base
   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);
-#if LDC_LLVM_VER >= 308
+#if LDC_LLVM_VER >= 308 && LDC_LLVM_VER < 400
     return owner().ArgStr.data();
 #else
     return owner().ArgStr;
 #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);
-#if LDC_LLVM_VER >= 308
+#if LDC_LLVM_VER >= 308 && LDC_LLVM_VER < 400
     return owner().HelpStr.data();
 #else
     return owner().HelpStr;
diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp
index abeb4b0..6abec42 100644
--- a/gen/llvmhelpers.cpp
+++ b/gen/llvmhelpers.cpp
@@ -1375,6 +1375,9 @@ bool isLLVMUnsigned(Type *t) { return t->isunsigned() || t->ty == Tpointer; }
 void printLabelName(std::ostream &target, const char *func_mangle,
                     const char *label_name) {
   target << gTargetMachine->getMCAsmInfo()->getPrivateGlobalPrefix()
+#if LDC_LLVM_VER >= 400
+              .str()
+#endif
          << func_mangle << "_" << label_name;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list