wcslen is part of the C99 and C++98 standards.
- This introduces the function to TargetLibraryInfo.
- Also set attributes for wcslen in llvm::inferLibFuncAttributes().
Differential Revision: https://reviews.llvm.org/D32837
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302278
91177308-0d34-0410-b5e6-
96231b3b80d8
/// int vsscanf(const char *s, const char *format, va_list arg);
TLI_DEFINE_ENUM_INTERNAL(vsscanf)
TLI_DEFINE_STRING_INTERNAL("vsscanf")
+/// size_t wcslen (const wchar_t* wcs);
+TLI_DEFINE_ENUM_INTERNAL(wcslen)
+TLI_DEFINE_STRING_INTERNAL("wcslen")
/// ssize_t write(int fildes, const void *buf, size_t nbyte);
TLI_DEFINE_ENUM_INTERNAL(write)
TLI_DEFINE_STRING_INTERNAL("write")
FTy.getParamType(0)->isPointerTy() &&
FTy.getParamType(1) == SizeTTy && FTy.getParamType(2) == SizeTTy);
+ case LibFunc_wcslen:
+ return (NumParams == 1 && FTy.getParamType(0)->isPointerTy() &&
+ FTy.getReturnType()->isIntegerTy());
+
case LibFunc::NumLibFuncs:
break;
}
bool Changed = false;
switch (TheLibFunc) {
case LibFunc_strlen:
+ case LibFunc_wcslen:
Changed |= setOnlyReadsMemory(F);
Changed |= setDoesNotThrow(F);
Changed |= setDoesNotCapture(F, 0);
"declare i32 @vsnprintf(i8*, i64, i8*, %struct*)\n"
"declare i32 @vsprintf(i8*, i8*, %struct*)\n"
"declare i32 @vsscanf(i8*, i8*, %struct*)\n"
+ "declare i64 @wcslen(i32*)\n"
// These functions were also extracted from the OS X headers, but they are
// available with a special name on darwin.