Index: llvm/include/llvm/Support/Compiler.h =================================================================== --- llvm/include/llvm/Support/Compiler.h +++ llvm/include/llvm/Support/Compiler.h @@ -122,6 +122,11 @@ /// LLVM_NODISCARD - Warn if a type or return value is discarded. #if __cplusplus > 201402L && __has_cpp_attribute(nodiscard) #define LLVM_NODISCARD [[nodiscard]] +// Detect MSVC directly, since __cplusplus still defaults to old version +#elif _MSVC_LANG >= 201703L +#define LLVM_NODISCARD [[nodiscard]] +#elif _MSC_VER +#define LLVM_NODISCARD #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. @@ -242,6 +247,11 @@ /// LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements. #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) #define LLVM_FALLTHROUGH [[fallthrough]] +// Detect MSVC directly, since __cplusplus still defaults to old version +#elif _MSVC_LANG >= 201703L +#define LLVM_FALLTHROUGH [[fallthrough]] +#elif _MSC_VER +#define LLVM_FALLTHROUGH #elif __has_cpp_attribute(gnu::fallthrough) #define LLVM_FALLTHROUGH [[gnu::fallthrough]] #elif !__cplusplus