summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorHans Wennborg <hans@chromium.org>2020-02-03 17:45:43 +0100
committerHans Wennborg <hans@chromium.org>2020-02-03 17:50:03 +0100
commitd2a710ea784eea43c63e3831224de6355f1e4a6f (patch)
tree636d6cbcb7421d2ebb3e7f064b8db67316067668 /llvm/include
parent4ea9a4aba4a7cfea0325022d50b97a9409026ab5 (diff)
downloadbcm5719-llvm-d2a710ea784eea43c63e3831224de6355f1e4a6f.tar.gz
bcm5719-llvm-d2a710ea784eea43c63e3831224de6355f1e4a6f.zip
Actually, don't try to use __builtin_strlen in StringRef.h before VS 2019
The fix in b3d7d1061dc375bb5ea725e6597382fcd37f41d6 compiled nicely, but didn't link because at least the VS 2017 version I use doesn't have the builtin yet. Instead, make use of the builtin with MSVC conditional on VS 2019 or later. (cherry picked from commit ff837aa63cdfadb58f387ca77785ca3ca51c6976)
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/ADT/StringRef.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index 6d75cf8b04e..7c13b5d17ec 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -24,7 +24,7 @@
// Declare the __builtin_strlen intrinsic for MSVC so it can be used in
// constexpr context.
#if defined(_MSC_VER)
-extern "C" constexpr size_t __builtin_strlen(const char *);
+extern "C" size_t __builtin_strlen(const char *);
#endif
namespace llvm {
@@ -77,7 +77,8 @@ namespace llvm {
static constexpr size_t strLen(const char *Str) {
#if __cplusplus > 201402L
return std::char_traits<char>::length(Str);
-#elif __has_builtin(__builtin_strlen) || defined(__GNUC__) || defined(_MSC_VER)
+#elif __has_builtin(__builtin_strlen) || defined(__GNUC__) || \
+ (defined(_MSC_VER) && _MSC_VER >= 1920)
return __builtin_strlen(Str);
#else
const char *Begin = Str;
OpenPOWER on IntegriCloud