BumpPtrAllocator: do the size check without moving any pointers
[oota-llvm.git] / include / llvm / Support / Compiler.h
index 8ede85539b4341b1337fd471dd7acc26c4b8b190..85f0cc6a39176f79107a472561aee55289ff048d 100644 (file)
 #define LLVM_MSC_PREREQ(version) 0
 #endif
 
+#ifndef _MSC_VER
+#define LLVM_NOEXCEPT noexcept
+#else
+#define LLVM_NOEXCEPT
+#endif
+
 /// \brief Does the compiler support r-value reference *this?
 ///
 /// Sadly, this is separate from just r-value reference support because GCC
 /// public:
 ///   ...
 /// };
-#if __has_feature(cxx_deleted_functions) || LLVM_MSC_PREREQ(1800)
+#if __has_feature(cxx_deleted_functions) || \
+    defined(__GXX_EXPERIMENTAL_CXX0X__) || LLVM_MSC_PREREQ(1800)
 #define LLVM_DELETED_FUNCTION = delete
 #else
 #define LLVM_DELETED_FUNCTION
 #endif
 
-#if __has_feature(cxx_constexpr)
+#if __has_feature(cxx_constexpr) || defined(__GXX_EXPERIMENTAL_CXX0X__)
 # define LLVM_CONSTEXPR constexpr
 #else
 # define LLVM_CONSTEXPR
 #define LLVM_ATTRIBUTE_NORETURN
 #endif
 
+#if __has_attribute(returns_nonnull) || __GNUC_PREREQ(4, 9)
+#define LLVM_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
+#else
+#define LLVM_ATTRIBUTE_RETURNS_NONNULL
+#endif
+
 /// LLVM_EXTENSION - Support compilers where we have a keyword to suppress
 /// pedantic diagnostics.
 #ifdef __GNUC__
 /// \macro LLVM_EXPLICIT
 /// \brief Expands to explicit on compilers which support explicit conversion
 /// operators. Otherwise expands to nothing.
-#if __has_feature(cxx_explicit_conversions) || LLVM_MSC_PREREQ(1800)
+#if __has_feature(cxx_explicit_conversions) || \
+    defined(__GXX_EXPERIMENTAL_CXX0X__) || LLVM_MSC_PREREQ(1800)
 #define LLVM_EXPLICIT explicit
 #else
 #define LLVM_EXPLICIT