diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-05-20 02:44:14 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-05-20 02:44:14 +0000 |
commit | b0c5df902ef544f55addeeee1245e27934ce6e98 (patch) | |
tree | f356ee7db041c228e28cb7a6244d9b65250ea594 | |
parent | 665bc9c9362ad8790951c17d27d9c8da41bc332d (diff) | |
download | bcm5719-llvm-b0c5df902ef544f55addeeee1245e27934ce6e98.tar.gz bcm5719-llvm-b0c5df902ef544f55addeeee1245e27934ce6e98.zip |
Support: Introduce LLVM_FALLTHROUGH macro.
llvm-svn: 237766
-rw-r--r-- | llvm/include/llvm/Support/Compiler.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index c81fbaff9db..4da7fd48fa5 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -29,6 +29,10 @@ # 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 @@ -401,4 +405,12 @@ #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 |