[llvm] b3d7d10 - Declare __builtin_strlen in StringRef.h as constexpr
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 07:58:19 PST 2020
Author: Hans Wennborg
Date: 2020-02-03T16:58:01+01:00
New Revision: b3d7d1061dc375bb5ea725e6597382fcd37f41d6
URL: https://github.com/llvm/llvm-project/commit/b3d7d1061dc375bb5ea725e6597382fcd37f41d6
DIFF: https://github.com/llvm/llvm-project/commit/b3d7d1061dc375bb5ea725e6597382fcd37f41d6.diff
LOG: 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'
Added:
Modified:
llvm/include/llvm/ADT/StringRef.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index e0d0bbc593a7..31b0a5c6780f 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -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 {
More information about the llvm-commits
mailing list