llvm.org GIT mirror llvm / 738a26c
TargetLibraryInfo: Introduce wcslen 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 Matthias Braun 3 years ago
4 changed file(s) with 9 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11141114 /// int vsscanf(const char *s, const char *format, va_list arg);
11151115 TLI_DEFINE_ENUM_INTERNAL(vsscanf)
11161116 TLI_DEFINE_STRING_INTERNAL("vsscanf")
1117 /// size_t wcslen (const wchar_t* wcs);
1118 TLI_DEFINE_ENUM_INTERNAL(wcslen)
1119 TLI_DEFINE_STRING_INTERNAL("wcslen")
11171120 /// ssize_t write(int fildes, const void *buf, size_t nbyte);
11181121 TLI_DEFINE_ENUM_INTERNAL(write)
11191122 TLI_DEFINE_STRING_INTERNAL("write")
11751175 FTy.getParamType(0)->isPointerTy() &&
11761176 FTy.getParamType(1) == SizeTTy && FTy.getParamType(2) == SizeTTy);
11771177
1178 case LibFunc_wcslen:
1179 return (NumParams == 1 && FTy.getParamType(0)->isPointerTy() &&
1180 FTy.getReturnType()->isIntegerTy());
1181
11781182 case LibFunc::NumLibFuncs:
11791183 break;
11801184 }
112112 bool Changed = false;
113113 switch (TheLibFunc) {
114114 case LibFunc_strlen:
115 case LibFunc_wcslen:
115116 Changed |= setOnlyReadsMemory(F);
116117 Changed |= setDoesNotThrow(F);
117118 Changed |= setDoesNotCapture(F, 0);
333333 "declare i32 @vsnprintf(i8*, i64, i8*, %struct*)\n"
334334 "declare i32 @vsprintf(i8*, i8*, %struct*)\n"
335335 "declare i32 @vsscanf(i8*, i8*, %struct*)\n"
336 "declare i64 @wcslen(i32*)\n"
336337
337338 // These functions were also extracted from the OS X headers, but they are
338339 // available with a special name on darwin.