clover: Fix build against clang SVN >= r299965
authorMichel Dänzer <michel.daenzer@amd.com>
Wed, 12 Apr 2017 08:17:34 +0000 (17:17 +0900)
committerMichel Dänzer <michel@daenzer.net>
Thu, 13 Apr 2017 03:51:24 +0000 (12:51 +0900)
clang::LangAS::Offset is gone, the behaviour is as if it was 0.

v2: Introduce and use clover::llvm::compat::lang_as_offset (Francisco
    Jerez)

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/state_trackers/clover/llvm/codegen/common.cpp
src/gallium/state_trackers/clover/llvm/compat.hpp

index 13ccd591c117f0e699a301b5e2c64304cce228ab..3b0014d8797910956ce1d11e27ea606cc53c8c9b 100644 (file)
@@ -129,7 +129,7 @@ namespace {
                   cast<::llvm::PointerType>(actual_type)->getAddressSpace();
 
                if (address_space == address_spaces[clang::LangAS::opencl_local
-                                                   - clang::LangAS::Offset]) {
+                                                   - compat::lang_as_offset]) {
                   args.emplace_back(module::argument::local, arg_api_size,
                                     target_size, target_align,
                                     module::argument::zero_ext);
index 906367b3146b3e000334acb81bb3aeb00a09ad30..67d2d0fd546c61c0b118c6e57e0db76aa1f2d3f9 100644 (file)
@@ -67,6 +67,12 @@ namespace clover {
          typedef ::llvm::TargetLibraryInfo target_library_info;
 #endif
 
+#if HAVE_LLVM >= 0x0500
+         const auto lang_as_offset = 0;
+#else
+         const auto lang_as_offset = clang::LangAS::Offset;
+#endif
+
          inline void
          set_lang_defaults(clang::CompilerInvocation &inv,
                            clang::LangOptions &lopts, clang::InputKind ik,