| /llvm-project-15.0.7/clang/test/Analysis/ |
| H A D | string-fail.c | 41 #define strnlen BUILTIN(strnlen) macro 45 if (strnlen(x, 10) < 5) in strnlen_liveness() 57 size_t a = strnlen(z.a, 10); in strnlen_subregion() 59 size_t b = strnlen(z.a, 10); in strnlen_subregion() 65 size_t c = strnlen(z.a, 10); in strnlen_subregion() 72 size_t a = strnlen(x, 10); in strnlen_argument() 73 size_t b = strnlen(x, 10); in strnlen_argument() 79 size_t c = strnlen(x, 10); in strnlen_argument() 100 size_t a = strnlen(x, 10); in strnlen_indirect() 103 size_t b = strnlen(x, 10); in strnlen_indirect() [all …]
|
| H A D | string.c | 219 size_t strnlen(const char *s, size_t maxlen); 227 clang_analyzer_eval(strnlen(a, 10) == 3); // expected-warning{{TRUE}} in strnlen_constant1() 232 clang_analyzer_eval(strnlen(a, 10) == 3); // expected-warning{{TRUE}} in strnlen_constant2() 243 clang_analyzer_eval(strnlen(a, 3) == 3); // expected-warning{{TRUE}} in strnlen_constant5() 248 clang_analyzer_eval(strnlen(a, 3) == 3); // expected-warning{{TRUE}} in strnlen_constant6() 250 clang_analyzer_eval(strnlen(a, 3) == 3); // expected-warning{{UNKNOWN}} in strnlen_constant6() 268 clang_analyzer_eval(strnlen(NULL, 0) == 0); // expected-warning{{TRUE}} in strnlen_zero() 274 return strnlen((char[]) { 'a', 'b', 0 }, 1); in strnlen_compound_literal() 279 return strnlen("abc", (int)f); in strnlen_unknown_limit() 287 size_t len = strnlen(x, 10); in strnlen_at_limit() [all …]
|
| /llvm-project-15.0.7/libc/test/src/string/ |
| H A D | strnlen_test.cpp | 15 ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(empty, 0)); in TEST() 17 ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(empty, 1)); in TEST() 22 ASSERT_EQ(static_cast<size_t>(1), __llvm_libc::strnlen(single, 1)); in TEST() 24 ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(single, 0)); in TEST() 26 ASSERT_EQ(static_cast<size_t>(1), __llvm_libc::strnlen(single, 2)); in TEST() 31 ASSERT_EQ(static_cast<size_t>(9), __llvm_libc::strnlen(many, 9)); in TEST() 33 ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(many, 3)); in TEST() 35 ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(many, 0)); in TEST() 42 ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 3)); in TEST() 44 ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 4)); in TEST() [all …]
|
| /llvm-project-15.0.7/llvm/test/Transforms/InstCombine/ |
| H A D | strnlen-1.ll | 7 declare i64 @strnlen(i8*, i64) 22 %len = call i64 @strnlen(i8* %ptr, i64 %n) 55 ; Fold strnlen(ax, 0) to 0. 67 ; Fold strnlen(ax, 1) to *ax ? 1 : 0. 82 ; Fold strnlen(s5, 0) to 0. 94 ; Fold strnlen(s5, 4) to 4. 106 ; Fold strnlen(s5, 5) to 5. 118 ; Fold strnlen(s5, (size_t)-1) to 5. 130 ; Fold strnlen(s5_3 + 4, 5) to 1. 142 ; Fold strnlen(s5_3 + 5, 5) to 0. [all …]
|
| H A D | strnlen-3.ll | 8 declare i64 @strnlen(i8*, i64) 17 ; Fold strnlen(sx + i, 0) to 0. 25 %len = call i64 @strnlen(i8* %ptr, i64 0) 30 ; Do not fold strnlen(sx + i, n). 45 ; Fold strnlen(a3 + i, 2) to min(3 - i, 2). 55 %len = call i64 @strnlen(i8* %ptr, i64 2) 60 ; Fold strnlen(a3 + i, 3) to min(3 - i, 3). 75 ; Fold strnlen(s3 + i, 0) to 0. 87 ; Fold strnlen(s5 + i, 0) to 0. 99 ; Fold strnlen(s5_3 + i, 0) to 0. [all …]
|
| H A D | strnlen-5.ll | 7 declare i64 @strnlen(i8*, i64) 14 ; Fold strnlen(ax, 0) == 0 to true. 22 %len = tail call i64 @strnlen(i8* %ptr, i64 0) 28 ; Fold strnlen(ax, 0) > 0 to false. 36 %len = tail call i64 @strnlen(i8* %ptr, i64 0) 42 ; Fold strnlen(ax, 1) == 0 to *ax == 0. 52 %len = tail call i64 @strnlen(i8* %ptr, i64 1) 58 ; Likewise, fold strnlen(ax, 1) < 1 to *ax == 0. 74 ; Fold strnlen(ax, 1) != 0 to *ax != 0. 106 ; Fold strnlen(ax, 9) == 0 to *ax == 0. [all …]
|
| H A D | strnlen-2.ll | 7 declare i64 @strnlen(i8*, i64) 16 ; Fold strnlen (C ? s3 : s5, 0) to 0. 24 %len = call i64 @strnlen(i8* %ptr, i64 0) 29 ; Fold strnlen (C ? s3 : s5, 1) to 1. 37 %len = call i64 @strnlen(i8* %ptr, i64 1) 42 ; Fold strnlen (C ? s3 : s5, 3) to 3. 52 %len = call i64 @strnlen(i8* %ptr, i64 3) 57 ; Fold strnlen (C ? s3 : s5, 4) to C ? 3 : 4. 67 %len = call i64 @strnlen(i8* %ptr, i64 4) 82 %len = call i64 @strnlen(i8* %ptr, i64 5) [all …]
|
| H A D | strnlen-6.ll | 2 ; Verify that strnlen calls that aren't folded into constants are annotated 8 declare i64 @strnlen(i8*, i64) 13 ; Annotate strnlen(ecp, 3) call with noundef, nonnull, and dereferenceable 19 ; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(i8* noundef nonnull dereferenceable(1) [[PTR]], i6… 23 %len = call i64 @strnlen(i8* %ptr, i64 3) 28 ; Annotate strnlen(ecp, %n) call with nonzero %n with noundef, nonnull, and 35 ; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(i8* noundef nonnull dereferenceable(1) [[PTR]], i6… 40 %len = call i64 @strnlen(i8* %ptr, i64 %nonzero) 46 ; Do not annotate strnlen(ecp, %n) call with nonnull etc. because it need 54 ; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(i8* [[PTR]], i64 [[N:%.*]]) [all …]
|
| H A D | strnlen-4.ll | 2 ; Verify that strnlen calls with conditional expressions involving constant 7 declare i64 @strnlen(i8*, i64) 15 ; Fold strnlen (C ? s3 + i : s5, %n) to min(C ? 3 : 5, i) when 22 ; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(i8* [[SEL]], i64 [[N:%.*]]) 28 %len = call i64 @strnlen(i8* %sel, i64 %n) 42 ; CHECK-NEXT: [[LEN:%.*]] = call i64 @strnlen(i8* [[SEL]], i64 [[N:%.*]]) 48 %len = call i64 @strnlen(i8* %sel, i64 %n) 53 ; Do not fold strnlen(C ? s3 + i : sx, n) when sx's length and size 68 %len = call i64 @strnlen(i8* %sel, i64 %n) 73 ; Fold strnlen (C ? s3 : s5 + i, n) to min(C ? 3 : 5, i). [all …]
|
| /llvm-project-15.0.7/clang/test/Sema/ |
| H A D | enable_if.c | 24 size_t strnlen(const char *s, size_t maxlen) 29 inline size_t strnlen(const char *s, size_t maxlen) in strnlen() function 37 size_t strnlen(const char *s, size_t maxlen) 45 size_t strnlen(const char *s, size_t maxlen) // expected-note {{'strnlen' has been explicitly marke… 56 strnlen(s, i); in test2() 58 strnlen(s, 999); in test2() 60 strnlen(c, 1); in test2() 62 strnlen(c, i); in test2() 65 …strnlen(c, 999); // expected-error{{'strnlen' is unavailable: 'maxlen' is larger than the buffer … in test2()
|
| /llvm-project-15.0.7/compiler-rt/test/sanitizer_common/TestCases/ |
| H A D | strnlen.c | 7 assert(strnlen(s, 0) == 0UL); in main() 8 assert(strnlen(s, 1) == 1UL); in main() 9 assert(strnlen(s, 6) == strlen(s)); in main() 10 assert(strnlen(s, 7) == strlen(s)); in main()
|
| /llvm-project-15.0.7/llvm/test/CodeGen/SystemZ/ |
| H A D | strlen-nobuiltin.ll | 1 ; Test that strlen/strnlen won't be converted to SRST if calls are 7 declare i64 @strnlen(i8 *%src, i64 %len) 17 ; Likewise for strnlen. 21 ; CHECK: brasl %r14, strnlen 23 %res = call i64 @strnlen(i8 *%src, i64 %len) nobuiltin
|
| H A D | strlen-01.ll | 6 declare i64 @strnlen(i8 *%src, i64 %len) 25 ; Test strnlen with its proper i64 prototype. 37 %res = call i64 @strnlen(i8 *%src, i64 %len)
|
| /llvm-project-15.0.7/llvm/test/CodeGen/AMDGPU/ |
| H A D | mem-builtins.ll | 8 declare hidden i32 @strnlen(i8* nocapture, i32) #1 63 …rror: <unknown>:0:0: in function test_strnlen void (i8*, i32): unsupported call to function strnlen 65 ; GCN: s_add_u32 s{{[0-9]+}}, s{{[0-9]+}}, strnlen@rel32@lo+4 66 ; GCN: s_addc_u32 s{{[0-9]+}}, s{{[0-9]+}}, strnlen@rel32@hi+12 68 %res = call i32 @strnlen(i8* %src, i32 %size)
|
| /llvm-project-15.0.7/llvm/test/Instrumentation/ThreadSanitizer/ |
| H A D | str-nobuiltin.ll | 13 declare i64 @strnlen(i8* %a, i64 %b) nounwind 21 ; CHECK: call{{.*}}@strnlen{{.*}} #[[ATTR]] 31 tail call i64 @strnlen(i8* %a, i64 12)
|
| /llvm-project-15.0.7/llvm/test/Instrumentation/MemorySanitizer/ |
| H A D | str-nobuiltin.ll | 13 declare i64 @strnlen(i8* %a, i64 %b) 21 ; CHECK: call{{.*}}@strnlen{{.*}} #[[ATTR]] 31 tail call i64 @strnlen(i8* %a, i64 12)
|
| /llvm-project-15.0.7/llvm/test/Instrumentation/AddressSanitizer/ |
| H A D | str-nobuiltin.ll | 13 declare i64 @strnlen(i8* %a, i64 %b) 21 ; CHECK: call{{.*}}@strnlen{{.*}} #[[ATTR]] 31 tail call i64 @strnlen(i8* %a, i64 12)
|
| /llvm-project-15.0.7/lld/MachO/ |
| H A D | ObjC.cpp | 37 strnlen(secHead.sectname, sizeof(secHead.sectname))); in objectHasObjCSection() 39 strnlen(secHead.segname, sizeof(secHead.segname))); in objectHasObjCSection()
|
| /llvm-project-15.0.7/clang-tools-extra/test/clang-tidy/checkers/bugprone/ |
| H A D | misplaced-operator-in-strlen-in-alloc.c | 10 size_t strnlen(const char *, size_t); 23 new_name = (char *)malloc(strnlen(name + 1, 10)); in bad_malloc()
|
| /llvm-project-15.0.7/compiler-rt/lib/asan/tests/ |
| H A D | asan_str_test.cpp | 118 Ident(strnlen(str - 1, 0)); in TEST() 119 Ident(strnlen(str, size)); in TEST() 120 Ident(strnlen(str + size - 1, 1)); in TEST() 122 Ident(strnlen(str, 2 * size)); in TEST() 124 EXPECT_DEATH(Ident(strnlen(str - 1, 1)), LeftOOBReadMessage(1)); in TEST() 125 EXPECT_DEATH(Ident(strnlen(str + size, 1)), RightOOBReadMessage(0)); in TEST() 128 EXPECT_DEATH(Ident(strnlen(str, size + 1)), RightOOBReadMessage(0)); in TEST()
|
| /llvm-project-15.0.7/libc/src/string/ |
| H A D | strnlen.h | 16 size_t strnlen(const char *src, size_t n);
|
| H A D | strnlen.cpp | 17 LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) {
|
| /llvm-project-15.0.7/clang/test/CodeGen/ |
| H A D | strlen-inline-builtin-redecl.c | 7 unsigned long strnlen(const char *, unsigned long);
|
| /llvm-project-15.0.7/libc/AOR_v20.02/string/ |
| H A D | Dir.mk | 38 build/bin/test/strnlen \ 90 $(EMULATOR) build/bin/test/strnlen
|
| /llvm-project-15.0.7/compiler-rt/lib/memprof/ |
| H A D | memprof_interceptors.h | 40 DECLARE_REAL(uptr, strnlen, const char *s, uptr maxlen)
|