Declare __builtin_strlen in StringRef.h as constexpr

Otherwise Visual Studio 2017 will complain about
llvm::StringRef::strlen not being constexpr:

  StringRef.h(80): error C3615: constexpr function 'llvm::StringRef::strLen' cannot result in a constant expression
  StringRef.h(84): note: failure was caused by call of undefined function or one not declared 'constexpr'
This commit is contained in:
Hans Wennborg 2020-02-03 16:56:15 +01:00
parent 3f0180f097
commit 41105ccc60

View File

@ -27,7 +27,7 @@
// Declare the __builtin_strlen intrinsic for MSVC so it can be used in
// constexpr context.
#if defined(_MSC_VER)
extern "C" size_t __builtin_strlen(const char *);
extern "C" constexpr size_t __builtin_strlen(const char *);
#endif
namespace llvm {