Support: Introduce LLVM_FALLTHROUGH macro.
[oota-llvm.git] / include / llvm / Support / Compiler.h
index c81fbaff9dba89f4ac5966a50efb432131415c45..4da7fd48fa58883475f453ae96dc5a604d33d81c 100644 (file)
 # define __has_attribute(x) 0
 #endif
 
+#ifndef __has_cpp_attribute
+# define __has_cpp_attribute(x) 0
+#endif
+
 #ifndef __has_builtin
 # define __has_builtin(x) 0
 #endif
 #define LLVM_THREAD_LOCAL
 #endif
 
+/// \macro LLVM_FALLTHROUGH
+/// \brief Marks an empty statement preceding a deliberate switch fallthrough.
+#if __has_cpp_attribute(clang::fallthrough)
+#define LLVM_FALLTHROUGH [[clang::fallthrough]]
+#else
+#define LLVM_FALLTHROUGH
+#endif
+
 #endif