Home
last modified time | relevance | path

Searched refs:strlen (Results 1 – 25 of 569) sorted by relevance

12345678910>>...23

/llvm-project-15.0.7/clang/test/Analysis/
H A Dstring.c79 #define strlen BUILTIN(strlen) macro
193 if (strlen(x) < 5) in strlen_liveness()
200 return strlen(str); in strlenWrapper()
355 if (strlen(y) == 4) in strcpy_overflow()
362 if (strlen(y) == 3) in strcpy_no_overflow()
410 if (strlen(y) == 4) in stpcpy_overflow()
417 if (strlen(y) == 3) in stpcpy_no_overflow()
457 if (strlen(y) != 4) in strcat_effects()
467 if (strlen(y) == 4) in strcat_overflow_0()
473 if (strlen(y) == 3) in strcat_overflow_1()
[all …]
H A Dbsd-string.c12 size_t strlen(const char *s);
62 len = strlen(buf); in f8()
68 len = strlen(buf); in f8()
74 len = strlen(buf); in f8()
80 len = strlen(buf); in f8()
92 clang_analyzer_eval(strlen(buf)==4);// expected-warning{{TRUE}} in f9()
97 clang_analyzer_eval(strlen(buf)>=4);// expected-warning{{TRUE}} in f9()
102 clang_analyzer_eval(strlen(unknown_dst));// expected-warning{{UNKNOWN}} in f9()
107 clang_analyzer_eval(strlen(buf));// expected-warning{{UNKNOWN}} in f9()
112 clang_analyzer_eval(strlen(unknown_dst));// expected-warning{{UNKNOWN}} in f9()
H A Dcomparison-implicit-casts.cpp74 size_t strlen(const char *s);
87 if (strlen(x) != value) return; in PR12206_strlen()
90 clang_analyzer_eval(strlen(x) >= 2); // expected-warning{{TRUE}} in PR12206_strlen()
91 clang_analyzer_eval(2 <= strlen(x)); // expected-warning{{TRUE}} in PR12206_strlen()
94 clang_analyzer_eval(strlen(x) != 1); // expected-warning{{TRUE}} in PR12206_strlen()
95 clang_analyzer_eval(1 != strlen(x)); // expected-warning{{TRUE}} in PR12206_strlen()
/llvm-project-15.0.7/llvm/test/Transforms/InstCombine/
H A Dstrlen-5.ll6 declare i64 @strlen(i8*)
11 ; Fold strlen(a5_4[0]) to 3.
18 %len = call i64 @strlen(i8* %ptr)
23 ; Fold strlen(&a5_4[0][1]) to 2.
35 ; Fold strlen(&a5_4[0][2]) to 1.
47 ; Fold strlen(&a5_4[0][3]) to 0.
59 ; Fold strlen(a5_4[1]) to 2.
71 ; Fold strlen(&a5_4[1][1]) to 1.
107 ; Fold strlen(a5_4[2]) to 1.
155 ; Fold strlen(a5_4[3]) to 0
[all …]
H A Dstrlen-7.ll6 declare i64 @strlen(i8*)
13 ; Fold strlen(a[I].a + J) and strlen(a[I].b + J) with constant I and J
55 ; Fold strlen(a[0].a) to 1.
61 ; Fold strlen(a[0].a + 1) to 0.
67 ; Fold strlen(a[0].a + 2) to 0.
73 ; Fold strlen(a[0].a + 3) to 0.
79 ; Fold strlen(a[0].b) to 2.
109 ; Fold strlen(a[1].a) to 3.
133 ; Fold strlen(a[1].b) to 4.
167 ; TODO: Fold strlen(a[I].a + X) and strlen(a[I].b + X) with constant I and
[all …]
H A Dstrlen-1.ll16 declare i32 @strlen(i8*)
25 %hello_l = call i32 @strlen(i8* %hello_p)
34 %null_l = call i32 @strlen(i8* %null_p)
55 ; Check strlen(x) == 0 --> *x == 0.
62 %hello_l = call i32 @strlen(i8* %hello_p)
73 %str_l = call i32 @strlen(i8* %str_p)
78 ; Check strlen(x) != 0 --> *x != 0.
96 %str_l = call i32 @strlen(i8* %str_p)
109 %l = call i32 @strlen(i8* %s)
114 ; strlen(@hello + x) --> 5 - x
[all …]
H A Dstrlen-8.ll10 declare i64 @strlen(i8*)
15 ; Fold strlen(&a5_4[0][I]) to I <= 3 ? 3 - I : 0.
24 %len = call i64 @strlen(i8* %ptr)
29 ; Fold strlen(&a5_4[1][I]) to I <= 2 ? 2 - I : 0.
38 %len = call i64 @strlen(i8* %ptr)
43 ; Fold strlen(&a5_4[2][I]) to i <= 1 ? 1 - I : 0.
52 %len = call i64 @strlen(i8* %ptr)
57 ; Fold strlen(&a5_4[3][I]) to 0.
66 %len = call i64 @strlen(i8* %ptr)
71 ; Fold strlen(&a5_4[4][I]) to 0.
[all …]
H A Dstrlen-6.ll27 declare i64 @strlen(i8*)
30 ; Fold strlen(a_s3.a) to 3.
37 %len = call i64 @strlen(i8* %ptr)
42 ; Fold strlen(&a_s3.a[1]) to 2.
49 %len = call i64 @strlen(i8* %ptr)
54 ; Fold strlen(&a_s3.a[2]) to 1.
61 %len = call i64 @strlen(i8* %ptr)
66 ; Fold strlen(&a_s3.a[3]) to 0.
78 ; Fold strlen(a_s3_s4.a) to 3.
90 ; Fold strlen(&a_s3_s4.a[2]) to 1.
[all …]
H A Dstrlen-9.ll8 declare i64 @strlen(i8*)
43 ; Verify that strlen(a5) is folded to 5.
45 %na5_p0 = call i64 @strlen(i8* %pa0_p0)
49 ; Verify that strlen(a5 + 5) is folded to 0.
51 %na5_p5 = call i64 @strlen(i8* %pa5_p5)
57 %ns5_p6 = call i64 @strlen(i8* %ps5_p6)
65 %na5_pi = call i64 @strlen(i8* %pa5_pi)
69 ; Verify that strlen(z0) is folded to 0.
71 %nz0_p0 = call i64 @strlen(i8* %pz0_p0)
80 %nz0_pi = call i64 @strlen(i8* %pz0_pi)
[all …]
H A Dstrlen-4.ll7 declare i64 @strlen(i8*)
30 %len = tail call i64 @strlen(i8* %sel)
55 %len = tail call i64 @strlen(i8* %sel)
62 ; strlen (x ? s5_3 + i : s5).
75 %len = tail call i64 @strlen(i8* %sel)
93 %len = tail call i64 @strlen(i8* %sel)
111 %len = tail call i64 @strlen(i8* %sel)
118 ; strlen (x ? s3 : s5_3 + j).
131 %len = tail call i64 @strlen(i8* %sel)
152 %len = tail call i64 @strlen(i8* %sel)
[all …]
/llvm-project-15.0.7/compiler-rt/test/profile/
H A Dinstrprof-bufferio.c48 strlen("Short Strings:\n")); in main()
50 lprofBufferIOWrite(BufferIO, SmallData, strlen(SmallData)); in main()
54 lprofBufferIOWrite(BufferIO, MediumData, strlen(MediumData)); in main()
57 strlen("Extra Long Strings:\n")); in main()
59 lprofBufferIOWrite(BufferIO, LargeData, strlen(LargeData)); in main()
63 lprofBufferIOWrite(BufferIO, MediumData, strlen(MediumData)); in main()
64 lprofBufferIOWrite(BufferIO, SmallData, strlen(SmallData)); in main()
66 lprofBufferIOWrite(BufferIO, "Endings:\n", strlen("Endings:\n")); in main()
67 lprofBufferIOWrite(BufferIO, "END\n", strlen("END\n")); in main()
68 lprofBufferIOWrite(BufferIO, "ENDEND\n", strlen("ENDEND\n")); in main()
[all …]
/llvm-project-15.0.7/clang-tools-extra/test/clang-tidy/checkers/bugprone/
H A Dnot-null-terminated-result-strlen.c15 position = (char *)memchr(src, '\0', strlen(src)); in bad_memchr_1()
36 memmove(dest, src, strlen(src)); in bad_memmove()
44 memmove_s(dst, 13, src, strlen(src) + 1); in good_memmove()
48 memmove_s(dest, 13, src, strlen(src)); in bad_memmove_s()
54 memmove_s(dest, 13, src, strlen(src) + 1); in good_memmove_s_1()
59 strerror_s(dest, strlen(strerror(errno)), errno); in bad_strerror_s()
71 return strncmp(str0, str1, (strlen(str0) + 1)); in bad_strncmp_1()
77 return strncmp(str2, str3, 1 + strlen(str2)); in bad_strncmp_2()
83 return strncmp(str4, str5, strlen(str4)); in good_strncmp_1_2()
99 strlen(long_source_name)); in bad_strxfrm_1()
[all …]
H A Dnot-null-terminated-result-in-initialization-strlen.c8 length = strlen(src); in path_sensitive_unknown_length()
13 int length = strlen(src); in bad_memchr()
25 int length = strlen(strerror(errno)); in bad_strerror_s()
35 int length = strlen(strerror(errno)); in good_strerror_s()
40 int length = strlen(str1) + 1; in bad_strncmp_1()
47 int length = strlen(str1) + 1; in good_strncmp_1()
52 return strncmp(str2, "foobar", (strlen("foobar") + 1)); in bad_strncmp_2()
58 return strncmp(str3, "foobar", 1 + strlen("foobar")); in bad_strncmp_3()
64 return strncmp(str, "foobar", strlen("foobar")); in good_strncmp_2_3()
69 int very_long_length_definition_name = strlen(long_source_name); in bad_strxfrm()
[all …]
H A Dnot-null-terminated-result-memcpy-safe.c15 memcpy(dest00, src, strlen(src)); in bad_memcpy_not_just_char_dest()
28 memcpy(dest01, src, strlen(src)); in bad_memcpy_known_dest()
45 memcpy(dest20, src, strlen(src)); in bad_memcpy_full_source_length()
58 memcpy(dest21, src, strlen(src) - 1); in bad_memcpy_partial_source_length()
66 strncpy_s(dst21, 14, src, strlen(src) - 1); in good__memcpy_partial_source_length()
74 memcpy_s(dest40, 13, src, strlen(src)); in bad_memcpy_s_unknown_dest()
85 memcpy_s(dest41, 13, src, strlen(src)); in bad_memcpy_s_known_dest()
102 memcpy_s(dest60, 13, src, strlen(src)); in bad_memcpy_s_full_source_length()
115 memcpy_s(dest61, 13, src, strlen(src) - 1); in bad_memcpy_s_partial_source_length()
123 strncpy_s(dst61, 14, src, strlen(src) - 1); in good_memcpy_s_partial_source_length()
H A Dmisplaced-operator-in-strlen-in-alloc.cpp7 size_t strlen(const char *);
14 size_t strlen(const char *);
18 char *new_name = (char *)std::malloc(std::strlen(name + 1)); in bad_std_malloc_std_strlen()
24 char *new_name = (char *)non_std::malloc(std::strlen(name + 1)); in ignore_non_std_malloc_std_strlen()
30 char *new_name = (char *)std::malloc(non_std::strlen(name + 1)); in ignore_std_malloc_non_std_strlen()
36 char *new_name = new char[std::strlen(name + 1)]; in bad_new_strlen()
42 char *new_name = new char[std::strlen(name) + 1]; in good_new_strlen()
55 C *new_name = new C[std::strlen(name + 1)]; in bad_custom_new_strlen()
H A Dmisplaced-operator-in-strlen-in-alloc.c9 size_t strlen(const char *);
20 char *new_name = (char *)malloc(strlen(name + 1)); in bad_malloc()
44 char *new_name = (char *)alloca(strlen(name + 1)); in bad_alloca()
50 char *new_names = (char *)calloc(2, strlen(name + 1)); in bad_calloc()
56 char *new_name = (char *)realloc(old_name, strlen(name + 1)); in bad_realloc()
62 char *new_name = (char *)malloc(strlen(name + 1) + 1); in intentional1()
68 char *new_name = (char *)malloc(strlen(name + 2)); in intentional2()
74 char *new_name = (char *)malloc(strlen((name + 1))); in intentional3()
82 char *new_name = (char *)alloc_ptr(strlen(name + 1)); in bad_indirect_alloc()
H A Dnot-null-terminated-result-memcpy-safe-cxx.cpp15 memcpy(dest00, src, strlen(src)); in bad_memcpy_not_just_char_dest()
28 memcpy(dest01, src, strlen(src)); in bad_memcpy_known_dest()
58 memcpy(dest21, src, strlen(src) - 1); in bad_memcpy_partial_source_length()
66 strncpy_s(dst21, src, strlen(src) - 1); in good_memcpy_partial_source_length()
74 memcpy_s(dest40, 13, src, strlen(src)); in bad_memcpy_s_unknown_dest()
85 memcpy_s(dest41, 13, src, strlen(src)); in bad_memcpy_s_known_dest()
102 memcpy_s(dest60, 13, src, strlen(src)); in bad_memcpy_s_full_source_length()
115 memcpy_s(dest61, 13, src, strlen(src) - 1); in bad_memcpy_s_partial_source_length()
123 strncpy_s(dst61, src, strlen(src) - 1); in good_memcpy_s_partial_source_length()
H A Dnot-null-terminated-result-memcpy-before-safe.c20 memcpy(dest00, src, strlen(src)); in bad_memcpy_not_just_char_dest()
33 memcpy(dest01, src, strlen(src)); in bad_memcpy_known_dest()
49 memcpy(dest20, src, strlen(src)); in bad_memcpy_full_source_length()
61 memcpy(dest21, src, strlen(src) - 1); in bad_memcpy_partial_source_length()
69 strncpy(dst21, src, strlen(src) - 1); in good_memcpy_partial_source_length()
70 dst21[strlen(src) - 1] = '\0'; in good_memcpy_partial_source_length()
H A Dnot-null-terminated-result-memcpy-safe-other.c24 const int length = strlen(src); in good_memcpy_null_terminated()
31 int length = strlen(src) + 1; in good_memcpy_proper_length()
51 memcpy(dest01, src, strlen(src)); in bad_memcpy_unknown_dest()
62 memcpy(dest02, "foobarbazqux", strlen("foobarbazqux")); in bad_memcpy_variable_array()
87 const int length = strlen(src); in bad_memcpy_dest_size_overflows()
96 const int length = strlen(src); in good_memcpy_dest_size_overflows()
/llvm-project-15.0.7/clang-tools-extra/docs/clang-tidy/checks/bugprone/
H A Dmisplaced-operator-in-strlen-in-alloc.rst1 .. title:: clang-tidy - bugprone-misplaced-operator-in-strlen-in-alloc
3 bugprone-misplaced-operator-in-strlen-in-alloc
6 Finds cases where ``1`` is added to the string in the argument to ``strlen()``,
13 ``strlen()``-like function are ignored, as are cases where the whole addition is
21 char *c = (char*) malloc(strlen(str + 1));
25 The suggested fix is to add ``1`` to the return value of ``strlen()`` and not
30 char *c = (char*) malloc(strlen(str) + 1);
38 char *c = new char[strlen(str + 1)];
43 add ``1`` to the return value of ``strlen()`` and not to its argument. In the
48 char *c = new char[strlen(str) + 1];
[all …]
/llvm-project-15.0.7/llvm/test/Transforms/InferAddressSpaces/AMDGPU/
H A Dunreachable-code-assert.ll8 ; CHECK: strlen.while11:
13 ; CHECK: strlen.while.done12:
19 strlen.while11: ; preds = %strlen.while11
23 br i1 %i2, label %strlen.while.done12, label %strlen.while11
25 strlen.while.done12: ; preds = %strlen.while11
/llvm-project-15.0.7/compiler-rt/test/msan/Linux/
H A Dglob_altdirfunc.cpp34 assert(__msan_test_shadow(s, strlen(s) + 1) == (size_t)-1); in my_gl_opendir()
39 assert(__msan_test_shadow(s, strlen(s) + 1) == (size_t)-1); in my_gl_lstat()
46 assert(__msan_test_shadow(s, strlen(s) + 1) == (size_t)-1); in my_gl_stat()
68 printf("%zu\n", strlen(globbuf.gl_pathv[0])); in main()
69 printf("%zu\n", strlen(globbuf.gl_pathv[1])); in main()
70 __msan_poison(globbuf.gl_pathv[0], strlen(globbuf.gl_pathv[0]) + 1); in main()
71 __msan_poison(globbuf.gl_pathv[1], strlen(globbuf.gl_pathv[1]) + 1); in main()
/llvm-project-15.0.7/flang/unittests/Runtime/
H A DStop.cpp36 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
40 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
44 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
48 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
57 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
61 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
65 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
69 EXPECT_EXIT(RTNAME(StopStatementText)(message, std::strlen(message), in TEST()
H A DRuntimeCrashTest.cpp61 buffer, bufferSize, format, std::strlen(format))}; in TEST()
71 buffer, bufferSize, format, std::strlen(format))}; in TEST()
87 buffer, bufferSize, format, std::strlen(format))}; in TEST()
98 buffer, bufferSize, format, std::strlen(format))}; in TEST()
109 buffer, bufferSize, format, std::strlen(format))}; in TEST()
120 buffer, bufferSize, format, std::strlen(format))}; in TEST()
127 buffer, bufferSize, format, std::strlen(format)); in TEST()
138 buffer, bufferSize, format, std::strlen(format))}; in TEST()
145 buffer, bufferSize, format, std::strlen(format)); in TEST()
156 buffer, bufferSize, format, std::strlen(format))}; in TEST()
/llvm-project-15.0.7/compiler-rt/test/msan/
H A Dtzset.cpp10 if (!strlen(tzname[0]) || !strlen(tzname[1])) in main()
13 if (!strlen(tzname[0]) || !strlen(tzname[1])) in main()

12345678910>>...23