[PATCH] D76997: Fix StringRef::strLen in windows with clang++ C++17
Isuru Fernando via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 16:45:15 PDT 2020
isuruf updated this revision to Diff 262257.
isuruf added a comment.
Prefer compiler builtin over C++ standard library
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76997/new/
https://reviews.llvm.org/D76997
Files:
llvm/include/llvm/ADT/StringRef.h
Index: llvm/include/llvm/ADT/StringRef.h
===================================================================
--- llvm/include/llvm/ADT/StringRef.h
+++ llvm/include/llvm/ADT/StringRef.h
@@ -78,11 +78,11 @@
// Constexpr version of std::strlen.
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__) || \
+#if __has_builtin(__builtin_strlen) || defined(__GNUC__) || \
(defined(_MSC_VER) && _MSC_VER >= 1916)
return __builtin_strlen(Str);
+#elif __cplusplus > 201402L && !defined(_MSC_VER)
+ return std::char_traits<char>::length(Str);
#else
const char *Begin = Str;
while (*Str != '\0')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76997.262257.patch
Type: text/x-patch
Size: 761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200505/9ecb982b/attachment.bin>
More information about the llvm-commits
mailing list