[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

LLVM Continuous Integration via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 28 01:06:25 PST 2024


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `clang-ppc64le-rhel` running on `ppc64le-clang-rhel-test` while building `clang-tools-extra` at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/4098

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp', '-fix', '--checks=-*,readability-implicit-bool-conversion', '-config={CheckOptions: {          readability-implicit-bool-conversion.CheckConversionsToBool: false,          readability-implicit-bool-conversion.CheckConversionsFromBool: true      }}', '--', '-std=c23', '-std=c++11', '-nostdinc++']...
------------------------ clang-tidy output -----------------------
3 warnings generated.
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:49:23: warning: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion]
   49 |     int intFromBool = boolValue; //
      |                       ^        
      |                       static_cast<int>( )
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:49:23: note: FIX-IT applied suggested code changes
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:49:32: note: FIX-IT applied suggested code changes
   49 |     int intFromBool = boolValue; //
      |                                ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:52:27: warning: implicit conversion 'bool' -> 'float' [readability-implicit-bool-conversion]
   52 |     float floatFromBool = boolValue; //
      |                           ^        
      |                           static_cast<float>( )
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:52:27: note: FIX-IT applied suggested code changes
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:52:36: note: FIX-IT applied suggested code changes
   52 |     float floatFromBool = boolValue; //
      |                                    ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:55:25: warning: implicit conversion 'bool' -> 'char' [readability-implicit-bool-conversion]
   55 |     char charFromBool = boolValue; //
      |                         ^        
      |                         static_cast<char>( )
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:55:25: note: FIX-IT applied suggested code changes
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp:55:34: note: FIX-IT applied suggested code changes
   55 |     char charFromBool = boolValue; //
      |                                  ^
clang-tidy applied 6 of 6 suggested fixes.

------------------------------------------------------------------
diff -u /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 08:56:21.058547168 +0000
+++ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 08:56:21.206548434 +0000
@@ -46,12 +46,12 @@
 
     // Conversions from bool to other types
     bool boolValue = true;
-    int intFromBool = boolValue; //
+    int intFromBool = static_cast<int>(boolValue); //
                                  //
                                  
-    float floatFromBool = boolValue; //
+    float floatFromBool = static_cast<float>(boolValue); //
                                      //
 
...

```

</details>

https://github.com/llvm/llvm-project/pull/120087


More information about the cfe-commits mailing list