@@ -2351,7 +2351,7 @@ Value *LibCallSimplifier::optimizePrintFString(CallInst *CI, IRBuilderBase &B) {
2351
2351
2352
2352
// printf("foo\n") --> puts("foo")
2353
2353
if (FormatStr.back () == ' \n ' &&
2354
- FormatStr.find (' %' ) == StringRef::npos ) { // No format characters.
2354
+ ! FormatStr.contains (' %' )) { // No format characters.
2355
2355
// Create a string literal with no \n on it. We expect the constant merge
2356
2356
// pass to be run after this pass, to merge duplicate strings.
2357
2357
FormatStr = FormatStr.drop_back ();
@@ -2421,7 +2421,7 @@ Value *LibCallSimplifier::optimizeSPrintFString(CallInst *CI,
2421
2421
if (CI->arg_size () == 2 ) {
2422
2422
// Make sure there's no % in the constant array. We could try to handle
2423
2423
// %% -> % in the future if we cared.
2424
- if (FormatStr.find (' %' ) != StringRef::npos )
2424
+ if (FormatStr.contains (' %' ))
2425
2425
return nullptr ; // we found a format specifier, bail out.
2426
2426
2427
2427
// sprintf(str, fmt) -> llvm.memcpy(align 1 str, align 1 fmt, strlen(fmt)+1)
@@ -2548,7 +2548,7 @@ Value *LibCallSimplifier::optimizeSnPrintFString(CallInst *CI,
2548
2548
if (CI->arg_size () == 3 ) {
2549
2549
// Make sure there's no % in the constant array. We could try to handle
2550
2550
// %% -> % in the future if we cared.
2551
- if (FormatStr.find (' %' ) != StringRef::npos )
2551
+ if (FormatStr.contains (' %' ))
2552
2552
return nullptr ; // we found a format specifier, bail out.
2553
2553
2554
2554
if (N == 0 )
@@ -2637,7 +2637,7 @@ Value *LibCallSimplifier::optimizeFPrintFString(CallInst *CI,
2637
2637
// fprintf(F, "foo") --> fwrite("foo", 3, 1, F)
2638
2638
if (CI->arg_size () == 2 ) {
2639
2639
// Could handle %% -> % if we cared.
2640
- if (FormatStr.find (' %' ) != StringRef::npos )
2640
+ if (FormatStr.contains (' %' ))
2641
2641
return nullptr ; // We found a format specifier.
2642
2642
2643
2643
return emitFWrite (
0 commit comments