mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 15:40:55 +03:00

By introducing abstractions for attribute builder and set since they differ greatly between LLVM 3.1-3.3.
66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
//===-- gen/llvmcompat.h - LLVM API compatibilty shims ----------*- C++ -*-===//
|
||
//
|
||
// LDC – the LLVM D compiler
|
||
//
|
||
// This file is distributed under the BSD-style LDC license. See the LICENSE
|
||
// file for details.
|
||
//
|
||
//===----------------------------------------------------------------------===//
|
||
//
|
||
// Provides a central place to handle API changes between supported LLVM
|
||
// versions.
|
||
//
|
||
//===----------------------------------------------------------------------===//
|
||
|
||
|
||
#ifdef _MSC_VER
|
||
#pragma once
|
||
#endif
|
||
|
||
#ifndef LDC_LLVMCOMPAT_H
|
||
#define LDC_LLVMCOMPAT_H
|
||
|
||
#if !defined(LDC_LLVM_VER)
|
||
#error "Please specify value for LDC_LLVM_VER."
|
||
#endif
|
||
|
||
#if LDC_LLVM_VER >= 302
|
||
#define ADDRESS_SPACE 0
|
||
#else
|
||
#define ADDRESS_SPACE
|
||
#endif
|
||
|
||
#if LDC_LLVM_VER < 302
|
||
#define LLVM_OVERRIDE
|
||
#define llvm_move(value) (value)
|
||
#endif
|
||
|
||
#ifndef __has_feature
|
||
# define __has_feature(x) 0
|
||
#endif
|
||
|
||
#if LDC_LLVM_VER >= 305
|
||
#if __has_feature(cxx_override_control) \
|
||
|| (defined(_MSC_VER) && _MSC_VER >= 1700)
|
||
#define LLVM_OVERRIDE override
|
||
#else
|
||
#define LLVM_OVERRIDE
|
||
#endif
|
||
|
||
#if (__has_feature(cxx_rvalue_references) \
|
||
|| defined(__GXX_EXPERIMENTAL_CXX0X__) \
|
||
|| (defined(_MSC_VER) && _MSC_VER >= 1600))
|
||
#define LLVM_HAS_RVALUE_REFERENCES 1
|
||
#else
|
||
#define LLVM_HAS_RVALUE_REFERENCES 0
|
||
#endif
|
||
|
||
#if LLVM_HAS_RVALUE_REFERENCES
|
||
#define llvm_move(value) (::std::move(value))
|
||
#else
|
||
#define llvm_move(value) (value)
|
||
#endif
|
||
|
||
#endif
|
||
|
||
#endif
|