| /llvm-project-15.0.7/libc/test/src/string/ |
| H A D | strncmp_test.cpp | 18 int result = __llvm_libc::strncmp(s1, s2, 1); in TEST() 22 result = __llvm_libc::strncmp(s2, s1, 1); in TEST() 36 result = __llvm_libc::strncmp(s3, empty, 3); in TEST() 48 result = __llvm_libc::strncmp(s2, s1, 3); in TEST() 61 result = __llvm_libc::strncmp(s2, s1, 8); in TEST() 75 result = __llvm_libc::strncmp(s2, s1, 4); in TEST() 89 result = __llvm_libc::strncmp(s2, s1, 4); in TEST() 101 result = __llvm_libc::strncmp(a, b, 1); in TEST() 115 result = __llvm_libc::strncmp(s2, s1, 0); in TEST() 126 result = __llvm_libc::strncmp(s2, s1, 1); in TEST() [all …]
|
| /llvm-project-15.0.7/llvm/test/Transforms/InstCombine/ |
| H A D | strncmp-1.ll | 2 ; Test that the strncmp library call simplifier works correctly. 12 declare i32 @strncmp(i8*, i8*, i32) 14 ; strncmp("", x, n) -> -*x 28 ; strncmp(x, "", n) -> *x 41 ; strncmp(x, y, n) -> cnst 75 ; strncmp(x,y,1) -> memcmp(x,y,1) 90 ; strncmp(x,y,0) -> 0 100 ; strncmp(x,x,n) -> 0 110 ; strncmp(nonnull x, nonnull y, n) -> strncmp(x, y, n) 121 ; strncmp(nonnull x, nonnull y, 0) -> 0 [all …]
|
| H A D | strncmp-4.ll | 11 declare i32 @strncmp(i8*, i8*, i64) 41 ; Fold strncmp(a.a = "123", a.b = "1231", 0) to 0. 46 ; Fold strncmp(a.a = "123", a.b = "1231", 1) to 0. 51 ; Fold strncmp(a.a = "123", a.b = "1231", 2) to 0. 56 ; Fold strncmp(a.a = "123", a.b = "1231", 3) to 0. 61 ; Fold strncmp(a.a = "123", a.b = "1231", 4) to 0. 71 ; Fold strncmp("123", "1231" "2", 5) to 0. 76 ; Fold strncmp("123", "1231" "23", 6) to 0. 81 ; Fold strncmp("123", "1231" "2345", 7) to 1. 86 ; Fold strncmp("123", "1231" "2345", 8) to 1. [all …]
|
| H A D | strncmp-5.ll | 7 declare i32 @strncmp(i8*, i8*, i64) 56 ; Fold strncmp(a, b, n) to 0. 61 ; Fold strncmp(a, b + 1, n) to N != 0 ? -1 : 0. 66 ; Fold strncmp(a, b + 2, n) to N != 0 ? -1 : 0. 71 ; Fold strncmp(a, b + 3, n) to N != 0 ? -1 : 0. 76 ; Fold strncmp(a, b + 4, n) to 0. 107 ; Do not fold strncmp(a, ax, n). 156 ; Fold strncmp(a, c, n) to N > 7 ? -1 : 0. 241 ; Fold strncmp(a, d, n) to N != 0 ? -1 : 0. 277 ; Fold strncmp(a + 5, d + 5, n) to 0. [all …]
|
| H A D | strncmp-6.ll | 7 declare i32 @strncmp(i8*, i8*, i64) 33 ; Fold strncmp(a + 5, b + 5, 2) to -1. 34 %ca5_b5 = call i32 @strncmp(i8* %p5, i8* %q5, i64 2) 38 ; Fold strncmp(b + 5, a + 5, 2) to +1. 39 %cb5_a5 = call i32 @strncmp(i8* %q5, i8* %p5, i64 2) 43 ; Fold strncmp(a + 6, b + 6, 1) to -1. 48 ; Fold strncmp(b + 6, a + 6, 1) to +1. 85 ; Fold strncmp(a, b, n) to -1. 90 ; Fold strncmp(b, a, n) to +1. 95 ; Fold strncmp(a + 6, b + 6, n) to -1. [all …]
|
| H A D | strncmp-3.ll | 4 ; Verify that an excessive size to strncmp() isn't truncated to an in-bounds 8 declare i32 @strncmp(i8*, i8*, i64) 17 ; Do not fold strncmp(ax, bx, UINT_MAX + (size_t)1) to 0. 21 ; CHECK-NEXT: [[RES:%.*]] = call i32 @strncmp(i8* noundef nonnull dereferenceable(1) getelementp… 27 %res = call i32 @strncmp(i8* %p1, i8* %p2, i64 4294967296) 32 ; Do not fold strncmp(ax, bx, UINT_MAX + (size_t)2) to *ax - *bx. 42 %res = call i32 @strncmp(i8* %p1, i8* %p2, i64 4294967296) 47 ; Fold strncmp(a12345, a123456, UINT_MAX + (size_t)2) to -1 (and not to 0). 56 %res = call i32 @strncmp(i8* %p1, i8* %p2, i64 4294967297) 61 ; Fold strncmp(a123456, a12345, UINT_MAX + (size_t)3) to +1 (and not to 0). [all …]
|
| H A D | strncmp-2.ll | 2 ; Test that the strncmp library call simplifier works correctly. 10 declare i16 @strncmp(i8*, i8*, i32) 14 ; CHECK-NEXT: [[TEMP1:%.*]] = call i16 @strncmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* … 20 %temp1 = call i16 @strncmp(i8* %str1, i8* %str2, i32 10)
|
| H A D | strncmp-wrong-datalayout.ll | 8 declare i32 @strncmp(i8*, i8*, i32) 12 ; CHECK: call i32 @strncmp(i8* %str1, i8* %str2, i32 1) 14 %temp1 = call i32 @strncmp(i8* %str1, i8* %str2, i32 1)
|
| H A D | strcmp-memcmp.ll | 157 …%call = call i32 @strncmp(i8* nonnull %string, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @ke… 163 declare i32 @strncmp(i8* nocapture, i8* nocapture, i64) 174 …%call = call i32 @strncmp(i8* nonnull %string, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @ke… 189 …%call = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*… 204 …%call = call i32 @strncmp(i8* nonnull %string, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @ke… 219 …%call = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*… 235 …%call = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*… 250 …%call = call i32 @strncmp(i8* nonnull %string, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @ke… 265 …%call = call i32 @strncmp(i8* nonnull %string, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @ke… 280 …%call = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @key, i64 0, i64 0), i8*… [all …]
|
| /llvm-project-15.0.7/compiler-rt/test/asan/TestCases/ |
| H A D | strncmp_strict.c | 37 assert((strncmp(s1, s2, i) == 0) == (i < size)); in main() 40 assert(strncmp(s1, s2, 2*size) == 0); in main() 43 return strncmp(s1-1, s2, 1); in main() 45 return strncmp(s1, s2-1, 1); in main() 47 return strncmp(s1+size, s2, 1); in main() 49 return strncmp(s1, s2+size, 1); in main() 51 return strncmp(s1+1, s2, size); in main() 53 return strncmp(s1, s2+1, size); in main() 56 assert(strncmp(s1, s2, 2*size) != 0); in main() 60 assert(strncmp(s1, s2, 2*size) != 0); in main()
|
| /llvm-project-15.0.7/compiler-rt/test/fuzzer/ |
| H A D | StrncmpTest.cpp | 16 if (Size >= 8 && strncmp(S, "123", 8)) in LLVMFuzzerTestOneInput() 18 if (Size >= 8 && strncmp(S, "01234567", 8) == 0) { in LLVMFuzzerTestOneInput() 19 if (Size >= 12 && strncmp(S + 8, "ABCD", 4) == 0) { in LLVMFuzzerTestOneInput() 20 if (Size >= 14 && strncmp(S + 12, "XY", 2) == 0) { in LLVMFuzzerTestOneInput() 21 if (Size >= 17 && strncmp(S + 14, "KLM", 3) == 0) { in LLVMFuzzerTestOneInput()
|
| /llvm-project-15.0.7/compiler-rt/lib/scudo/standalone/ |
| H A D | flags_parser.cpp | 112 if (strncmp(Value, "0", 1) == 0 || strncmp(Value, "no", 2) == 0 || in parseBool() 113 strncmp(Value, "false", 5) == 0) { in parseBool() 117 if (strncmp(Value, "1", 1) == 0 || strncmp(Value, "yes", 3) == 0 || in parseBool() 118 strncmp(Value, "true", 4) == 0) { in parseBool() 128 if (strncmp(Name, Flags[I].Name, Len) != 0 || Name[Len] != '=') in runHandler()
|
| /llvm-project-15.0.7/clang-tools-extra/test/clang-tidy/checkers/bugprone/ |
| H A D | not-null-terminated-result-in-initialization-strlen.c | 41 return strncmp(str1, str2, length); in bad_strncmp_1() 48 return strncmp(str1, str2, length - 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()
|
| H A D | not-null-terminated-result-strlen.c | 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() 87 return strncmp(str6, "string", 7); in bad_strncmp_3() 93 return strncmp(str7, "string", 6); in good_strncmp_3()
|
| H A D | suspicious-string-compare.cpp | 27 int strncmp(const char *, const char *, size); 145 if (strncmp(A, "a", 1)) in test_implicit_compare_with_functions() 317 ? strcmp (s1, s2) : strncmp (s1, s2, n)))
|
| /llvm-project-15.0.7/compiler-rt/lib/gwp_asan/optional/ |
| H A D | options_parser.cpp | 139 if (strncmp(Value, "0", 1) == 0 || strncmp(Value, "no", 2) == 0 || in parseBool() 140 strncmp(Value, "false", 5) == 0) { in parseBool() 144 if (strncmp(Value, "1", 1) == 0 || strncmp(Value, "yes", 3) == 0 || in parseBool() 145 strncmp(Value, "true", 4) == 0) { in parseBool() 155 if (strncmp(Name, Options[I].Name, Len) != 0 || Name[Len] != '=') in setOptionToValue()
|
| /llvm-project-15.0.7/clang/test/Analysis/ |
| H A D | string.c | 904 #define strncmp BUILTIN(strncmp) macro 905 int strncmp(const char *s1, const char *s2, size_t n); 910 clang_analyzer_eval(strncmp(x, y, 2) > 0); // expected-warning{{TRUE}} in strncmp_check_modelling() 914 clang_analyzer_eval(strncmp(y, x, 2) < 0); // expected-warning{{TRUE}} in strncmp_check_modelling() 942 clang_analyzer_eval(strncmp(x, y, 3) > 0); // expected-warning{{TRUE}} in strncmp_1() 948 clang_analyzer_eval(strncmp(x, y, 3) < 0); // expected-warning{{TRUE}} in strncmp_2() 966 clang_analyzer_eval(strncmp(x, y, 5) < 0); // expected-warning{{TRUE}} in strncmp_diff_length_0() 972 clang_analyzer_eval(strncmp(x, y, 5) < 0); // expected-warning{{TRUE}} in strncmp_diff_length_1() 978 clang_analyzer_eval(strncmp(x, y, 5) > 0); // expected-warning{{TRUE}} in strncmp_diff_length_2() 984 clang_analyzer_eval(strncmp(x, y, 5) < 0); // expected-warning{{TRUE}} in strncmp_diff_length_3() [all …]
|
| /llvm-project-15.0.7/compiler-rt/lib/fuzzer/ |
| H A D | FuzzerInterceptors.cpp | 62 static int internal_strcmp_strncmp(const char *s1, const char *s2, bool strncmp, in internal_strcmp_strncmp() argument 66 if (strncmp) { in internal_strcmp_strncmp() 143 DEFINE_REAL(int, strncmp, const char *, const char *, size_t) in DEFINE_REAL() 167 ATTRIBUTE_INTERFACE int strncmp(const char *s1, const char *s2, size_t n) { in strncmp() function 170 int result = REAL(strncmp)(s1, s2, n); in strncmp() 235 REAL(strncmp) = reinterpret_cast<strncmp_type>( in fuzzerInit() 236 getFuncAddr("strncmp", reinterpret_cast<uintptr_t>(&strncmp))); in fuzzerInit()
|
| /llvm-project-15.0.7/llvm/lib/Demangle/ |
| H A D | DLangDemangle.cpp | 486 if (strncmp(Mangled, "__initZ", Len + 1) == 0) { in parseLName() 493 if (strncmp(Mangled, "__vtblZ", Len + 1) == 0) { in parseLName() 503 if (strncmp(Mangled, "__ClassZ", Len + 1) == 0) { in parseLName() 513 if (strncmp(Mangled, "__InterfaceZ", Len + 1) == 0) { in parseLName() 523 if (strncmp(Mangled, "__ModuleInfoZ", Len + 1) == 0) { in parseLName() 547 if (MangledName == nullptr || strncmp(MangledName, "_D", 2) != 0) in dlangDemangle()
|
| H A D | Demangle.cpp | 19 return std::strncmp(S, "_Z", 2) == 0 || std::strncmp(S, "___Z", 4) == 0; in isItaniumEncoding()
|
| /llvm-project-15.0.7/compiler-rt/test/sanitizer_common/TestCases/Linux/ |
| H A D | b64.cpp | 24 assert(strncmp(reinterpret_cast<const char *>(target), src, res) == 0); in main() 39 assert(strncmp(reinterpret_cast<const char *>(target), src, res) == 0); in main()
|
| /llvm-project-15.0.7/compiler-rt/lib/asan/tests/ |
| H A D | asan_str_test.cpp | 301 EXPECT_EQ(0, strncmp("a", "b", 0)); in TEST() 302 EXPECT_EQ(0, strncmp("abcd", "abcd", 10)); in TEST() 303 EXPECT_EQ(0, strncmp("abcd", "abcef", 3)); in TEST() 304 EXPECT_GT(0, strncmp("abcde", "abcfa", 4)); in TEST() 305 EXPECT_GT(0, strncmp("a", "b", 5)); in TEST() 306 EXPECT_GT(0, strncmp("bc", "bcde", 4)); in TEST() 307 EXPECT_LT(0, strncmp("xyz", "xyy", 10)); in TEST() 308 EXPECT_LT(0, strncmp("baa", "aaa", 1)); in TEST() 309 EXPECT_LT(0, strncmp("zyx", "", 2)); in TEST() 405 RunStrNCmpTest(&strncmp); in TEST()
|
| /llvm-project-15.0.7/clang/test/SemaCXX/ |
| H A D | warn-memsize-comparison.cpp | 9 extern "C" int strncmp(const char *s1, const char *s2, size_t n); 44 if (strncmp(b1, b2, sizeof(b1) > 0)) {} // \ in f() 48 if (strncmp(b1, b2, sizeof(b1)) > 0) {} in f()
|
| /llvm-project-15.0.7/lldb/tools/debugserver/source/ |
| H A D | RNBRemote.cpp | 2020 } else if (strncmp(p, "LOG_MEMORY_DATA_SHORT", in set_logging() 2024 } else if (strncmp(p, "LOG_MEMORY_DATA_LONG", in set_logging() 2035 } else if (strncmp(p, "LOG_BREAKPOINTS", in set_logging() 2042 } else if (strncmp(p, "LOG_WATCHPOINTS", in set_logging() 2064 } else if (strncmp(p, "LOG_RNB_MINIMAL", in set_logging() 2091 } else if (strncmp(p, "LOG_RNB_PACKETS", in set_logging() 2098 } else if (strncmp(p, "LOG_RNB_DEFAULT", in set_logging() 5338 if (strncmp(c, "true", 4) == 0) { in get_boolean_value_for_key_name_from_json() 5341 } else if (strncmp(c, "false", 5) == 0) { in get_boolean_value_for_key_name_from_json() 5614 if (strncmp(p, thread_extended_info_str, in HandlePacket_jThreadExtendedInfo() [all …]
|
| /llvm-project-15.0.7/llvm/include/llvm/Demangle/ |
| H A D | StringView.h | 104 return std::strncmp(Str.begin(), begin(), Str.size()) == 0; in startsWith() 117 std::strncmp(LHS.begin(), RHS.begin(), LHS.size()) == 0;
|