Index: include/llvm/Support/Compiler.h =================================================================== --- include/llvm/Support/Compiler.h +++ include/llvm/Support/Compiler.h @@ -38,6 +38,13 @@ #ifndef __has_cpp_attribute # define __has_cpp_attribute(x) 0 +# define __has_cpp_attribute_qualified(x) 0 +#elif defined(_MSC_VER) +// MSVC only allows simple identifier in feature-test macros, +// and reports IntelliSense error otherwise. +# define __has_cpp_attribute_qualified(x) 0 +#else +# define __has_cpp_attribute_qualified __has_cpp_attribute #endif #ifndef __has_builtin @@ -127,7 +134,7 @@ // Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious // error when __has_cpp_attribute is given a scoped attribute in C mode. #define LLVM_NODISCARD -#elif __has_cpp_attribute(clang::warn_unused_result) +#elif __has_cpp_attribute_qualified(clang::warn_unused_result) #define LLVM_NODISCARD [[clang::warn_unused_result]] #else #define LLVM_NODISCARD @@ -243,13 +250,13 @@ /// LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements. #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) #define LLVM_FALLTHROUGH [[fallthrough]] -#elif __has_cpp_attribute(gnu::fallthrough) +#elif __has_cpp_attribute_qualified(gnu::fallthrough) #define LLVM_FALLTHROUGH [[gnu::fallthrough]] #elif !__cplusplus // Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious // error when __has_cpp_attribute is given a scoped attribute in C mode. #define LLVM_FALLTHROUGH -#elif __has_cpp_attribute(clang::fallthrough) +#elif __has_cpp_attribute_qualified(clang::fallthrough) #define LLVM_FALLTHROUGH [[clang::fallthrough]] #else #define LLVM_FALLTHROUGH