Skip to content

Conversation

@4m4n-x-B4w4ne
Copy link
Contributor

@4m4n-x-B4w4ne 4m4n-x-B4w4ne commented Dec 16, 2024

Fixes: #36323 , I added two new options in the clang-tools-extra/clan-tidy/readibility/ImplicitBoolConversionCheck.cpp and header file.
I have also written new test cases to test these new options in test/readibility directory.

Added new options in ImplicitBoolConversionCheck CheckConversionToBool and CheckConversionFromBool.
Added CheckConversionToBool and CheckConversionFromBool Options in the header
Added new test to check the new options added in the ImplicitBoolConversionCheck.cpp
@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2024

@llvm/pr-subscribers-clang-tools-extra

@llvm/pr-subscribers-clang-tidy

Author: None (4m4n-x-B4w4ne)

Changes

As given in the issue #36323 , I added two new options in the clang-tools-extra/clan-tidy/readibility/ImplicitBoolConversionCheck.cpp and header file.
I have also written new test cases to test these new options in test/readibility directory.


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

3 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp (+9-6)
  • (modified) clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h (+2)
  • (added) clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp (+92)
diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
index f9fd1d903e231e..517a5d2b982751 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
@@ -258,14 +258,17 @@ ImplicitBoolConversionCheck::ImplicitBoolConversionCheck(
     : ClangTidyCheck(Name, Context),
       AllowIntegerConditions(Options.get("AllowIntegerConditions", false)),
       AllowPointerConditions(Options.get("AllowPointerConditions", false)),
-      UseUpperCaseLiteralSuffix(
-          Options.get("UseUpperCaseLiteralSuffix", false)) {}
+      UseUpperCaseLiteralSuffix(Options.get("UseUpperCaseLiteralSuffix", false)),
+      CheckConversionsToBool(Options.get("CheckConversionsToBool",true)),
+      CheckConversionsFromBool(Options.get("CheckConversionsFromBool",true)) {}
 
 void ImplicitBoolConversionCheck::storeOptions(
     ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "AllowIntegerConditions", AllowIntegerConditions);
   Options.store(Opts, "AllowPointerConditions", AllowPointerConditions);
   Options.store(Opts, "UseUpperCaseLiteralSuffix", UseUpperCaseLiteralSuffix);
+  Options.store(Opts,"CheckConversionsToBool",CheckConversionsToBool);
+  Options.store(Opts,"CheckConversionsFromBool",CheckConversionsFromBool);
 }
 
 void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
@@ -358,14 +361,14 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
 void ImplicitBoolConversionCheck::check(
     const MatchFinder::MatchResult &Result) {
 
-  if (const auto *CastToBool =
-          Result.Nodes.getNodeAs<ImplicitCastExpr>("implicitCastToBool")) {
+  if (CheckConversionsToBool && (const auto *CastToBool =
+          Result.Nodes.getNodeAs<ImplicitCastExpr>("implicitCastToBool"))) {
     const auto *Parent = Result.Nodes.getNodeAs<Stmt>("parentStmt");
     return handleCastToBool(CastToBool, Parent, *Result.Context);
   }
 
-  if (const auto *CastFromBool =
-          Result.Nodes.getNodeAs<ImplicitCastExpr>("implicitCastFromBool")) {
+  if (CheckConversionsFromBool && (const auto *CastFromBool =
+          Result.Nodes.getNodeAs<ImplicitCastExpr>("implicitCastFromBool"))) {
     const auto *NextImplicitCast =
         Result.Nodes.getNodeAs<ImplicitCastExpr>("furtherImplicitCast");
     return handleCastFromBool(CastFromBool, NextImplicitCast, *Result.Context);
diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
index 5947f7316e67cc..b0c3c2943e649c 100644
--- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
+++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.h
@@ -37,6 +37,8 @@ class ImplicitBoolConversionCheck : public ClangTidyCheck {
   const bool AllowIntegerConditions;
   const bool AllowPointerConditions;
   const bool UseUpperCaseLiteralSuffix;
+  const bool CheckConversionsToBool;
+  const bool CheckConversionsFromBool;
 };
 
 } // namespace clang::tidy::readability
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp
new file mode 100644
index 00000000000000..506769d5a57322
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp
@@ -0,0 +1,92 @@
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t
+
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \
+// RUN: -- -config='{CheckOptions: [{key: readability-implicit-bool-conversion.CheckConversionsToBool, value: false}, {key: readability-implicit-bool-conversion.CheckConversionsFromBool, value: true}]}'
+
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \
+// RUN: -- -config='{CheckOptions: [{key: readability-implicit-bool-conversion.CheckConversionsToBool, value: true}, {key: readability-implicit-bool-conversion.CheckConversionsFromBool, value: false}]}'
+
+// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \
+// RUN: -- -config='{CheckOptions: [{key: readability-implicit-bool-conversion.CheckConversionsToBool, value: false}, {key: readability-implicit-bool-conversion.CheckConversionsFromBool, value: false}]}'
+
+// ==========================================================
+// Test Case: Conversions to bool (CheckConversionsToBool=true)
+// ==========================================================
+void TestConversionsToBool() {
+  int x = 42;
+  if (x) // CHECK-MESSAGES: :[[@LINE]]:8: warning: implicit conversion 'int' -> 'bool'
+    (void)0;
+
+  float f = 3.14;
+  if (f) // CHECK-MESSAGES: :[[@LINE]]:8: warning: implicit conversion 'float' -> 'bool'
+    (void)0;
+
+  int *p = nullptr;
+  if (p) // CHECK-MESSAGES: :[[@LINE]]:8: warning: implicit conversion 'int *' -> 'bool'
+    (void)0;
+
+  // Pointer-to-member
+  struct S {
+    int member;
+  };
+  int S::*ptr = nullptr;
+  if (ptr) // CHECK-MESSAGES: :[[@LINE]]:8: warning: implicit conversion 'int S::*' -> 'bool'
+    (void)0;
+}
+
+// ==========================================================
+// Test Case: Conversions from bool (CheckConversionsFromBool=true)
+// ==========================================================
+void TestConversionsFromBool() {
+  bool b = true;
+
+  int x = b; // CHECK-MESSAGES: :[[@LINE]]:12: warning: implicit conversion 'bool' -> 'int'
+  float f = b; // CHECK-MESSAGES: :[[@LINE]]:12: warning: implicit conversion 'bool' -> 'float'
+  int *p = b;  // CHECK-MESSAGES: :[[@LINE]]:12: warning: implicit conversion 'bool' -> 'int *'
+
+  struct S {
+    int member;
+  };
+  int S::*ptr = b; // CHECK-MESSAGES: :[[@LINE]]:16: warning: implicit conversion 'bool' -> 'int S::*'
+}
+
+// ==========================================================
+// Test Case: Mixed Configurations (ToBool=false, FromBool=true)
+// ==========================================================
+void TestMixedConfig() {
+  int x = 42;
+  if (x) // No warning: CheckConversionsToBool=false
+    (void)0;
+
+  bool b = true;
+  int y = b; // CHECK-MESSAGES: :[[@LINE]]:12: warning: implicit conversion 'bool' -> 'int'
+}
+
+// ==========================================================
+// Test Case: No Diagnostics (ToBool=false, FromBool=false)
+// ==========================================================
+void TestNoDiagnostics() {
+  int x = 42;
+  if (x) // No warning: CheckConversionsToBool=false
+    (void)0;
+
+  bool b = true;
+  int y = b; // No warning: CheckConversionsFromBool=false
+}
+
+// ==========================================================
+// Test Case: Edge Cases and Complex Expressions
+// ==========================================================
+void TestEdgeCases() {
+  bool b = true;
+
+  // Nested implicit casts
+  int x = (b ? 1 : 0); // CHECK-MESSAGES: :[[@LINE]]:12: warning: implicit conversion 'bool' -> 'int'
+
+  // Function returns implicit bool
+  auto ReturnBool = []() -> bool { return true; };
+  int y = ReturnBool(); // CHECK-MESSAGES: :[[@LINE]]:12: warning: implicit conversion 'bool' -> 'int'
+
+  // Explicit casts (no diagnostics)
+  int z = static_cast<int>(b); // No warning: explicit cast
+}

@4m4n-x-B4w4ne 4m4n-x-B4w4ne changed the title Added option to readability-implicit-bool-conversion check to allow implicit conversion *to bool* Added options to readability-implicit-bool-conversion Dec 16, 2024
@EugeneZelenko
Copy link
Contributor

Please mention options in Release Notes and check documentation.

Copy link
Contributor

@HerrCai0907 HerrCai0907 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update release note and doc also

Copy link
Member

@PiotrZSL PiotrZSL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • reformat code
  • missing release notes entry about new options added
  • missing documentation for newly added options
  • change should be in registerMatchers method

// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t

// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \
// RUN: -- -config='{CheckOptions: [{key: readability-implicit-bool-conversion.CheckConversionsToBool, value: false}, {key: readability-implicit-bool-conversion.CheckConversionsFromBool, value: true}]}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is old format for options, use new one like in other checks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay Thanks I am Working on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done this . Can you please review it?

void ImplicitBoolConversionCheck::check(
const MatchFinder::MatchResult &Result) {

if(CheckConversionsToBool){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong, place these things should be actually put into matcher in registerMatchers method, to speed up.

You got 2 calls to addMatcher, one in line 300, other in line 339, put those (with dependences to avoid unused local variables) into if's.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay Thanks I am Working on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can You please check this? I have done this now as instructed.

Added new Options in ImplicitBoolConversionCheck.
@4m4n-x-B4w4ne
Copy link
Contributor Author

update release note and doc also

I am doing it.

<clang-tidy/checks/readability/identifier-naming>` check to
validate ``namespace`` aliases.

-Improved :doc: `readability-implicit-bool-conversion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extend existing readability-implicit-bool-conversion entry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done Thanks.


-Improved :doc: `readability-implicit-bool-conversion
<clang-tidy/checks/readability/implicit-bool-conversion>`
- `CheckConversionsToBool`: Allows enabling or disabling warnings for implicit conversions to `bool` (default) : true .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default belongs to documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done Thanks.

case of the literal suffix in fixes and fixing false positive for implicit
conversion of comparison result in C23.
<clang-tidy/checks/readability/implicit-bool-conversion>`
- `UseUpperCaseLiteralSuffix` : check by adding the option to select the case of the literal suffix in fixes and fixing false positive for implicit conversion of comparison result in C23.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check by adding the options should be common for all three options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, if I was not clear, check by adding the options should be added once before list of added options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I have done it in Release Notes .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary to repeat check by adding the option thrice.

Copy link
Contributor Author

@4m4n-x-B4w4ne 4m4n-x-B4w4ne Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its looking good now?

@EugeneZelenko
Copy link
Contributor

New options are still not described in check documentation.

- `UseUpperCaseLiteralSuffix` : check by adding the option to select the case of the literal suffix in fixes and fixing false positive for implicit conversion of comparison result in C23.
- `CheckConversionsToBool`: check by adding the option to allow enabling or disabling warnings for implicit conversions to `bool` .
- `CheckConversionsFromBool`: check by adding the option to allow enabling or disabling warnings for implicit conversions from `bool`.
Check by adding the option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Belongs to previous line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but i havent got this one . Can you please clarify?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks got it now.

- `CheckConversionsToBool`: check by adding the option to allow enabling or disabling warnings for implicit conversions to `bool` .
- `CheckConversionsFromBool`: check by adding the option to allow enabling or disabling warnings for implicit conversions from `bool`.
Check by adding the option
- `UseUpperCaseLiteralSuffix` : to select the case of the literal suffix in fixes and fixing false positive for implicit conversion of comparison result in C23.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow 80-characters limit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done Thanks.

Updated for all permutations of configurations options and also for  the more comprehensive tests.
<clang-tidy/checks/readability/implicit-bool-conversion>` check by adding the
option `UseUpperCaseLiteralSuffix` to select the case of the literal suffix in
fixes and fixing false positive for implicit conversion of comparison result in
C23 , and by adding the option `CheckConversionsToBool` or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
C23 , and by adding the option `CheckConversionsToBool` or
C23, and by adding the option `CheckConversionsToBool` or

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, What needs to be done further? Can you please help me out?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix Clang-format complains.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done Thanks.

Copy link
Contributor

@HerrCai0907 HerrCai0907 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. If you do not have write access, please ping me. we can help you to do merge.

@github-actions
Copy link

github-actions bot commented Dec 27, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

FIxed Clang formatting issue.
@4m4n-x-B4w4ne
Copy link
Contributor Author

@HerrCai0907 , Thanks I dont have any write permissions. Can you please help me to merge?

@HerrCai0907 HerrCai0907 merged commit 5bec2b7 into llvm:main Dec 28, 2024
9 checks passed
@github-actions
Copy link

@4m4n-x-B4w4ne Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building clang-tools-extra at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/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/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 07:42:25.253479184 +0000
+++ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 07:42:25.357479722 +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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building clang-tools-extra at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/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/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 07:46:09.330637388 +0000
+++ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 07:46:09.378637636 +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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve2-vla running on linaro-g4-02 while building clang-tools-extra at step 7 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 07:43:00.166682047 +0000
+++ /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 07:43:00.179681665 +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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

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

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

Here is the relevant piece of the build log for the reference
Step 6 (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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/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-test-suite/clang-ppc64le-test-suite/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 02:52:16.929069947 -0500
+++ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 02:52:16.949070260 -0500
@@ -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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building clang-tools-extra at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/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-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 02:48:37.585642318 -0500
+++ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 02:48:37.755644975 -0500
@@ -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); //
                                      //
 
...
Step 11 (ninja check 2) failure: stage 2 checked (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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/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-multistage-test/clang-ppc64le-multistage/stage2/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 03:08:04.543889036 -0500
+++ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 03:08:05.063897168 -0500
@@ -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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-global-isel running on linaro-clang-aarch64-global-isel while building clang-tools-extra at step 7 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/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/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 08:01:51.255505569 +0000
+++ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 08:01:51.323505921 +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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-sve2-vla-2stage running on linaro-g4-01 while building clang-tools-extra at step 12 "ninja check 2".

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

Here is the relevant piece of the build log for the reference
Step 12 (ninja check 2) failure: stage 2 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/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/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 08:09:29.943050854 +0000
+++ /home/tcwg-buildbot/worker/clang-aarch64-sve2-vla-2stage/stage2/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 08:09:29.959050385 +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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-armv7-global-isel running on linaro-clang-armv7-global-isel while building clang-tools-extra at step 7 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/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/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 08:09:23.877844194 +0000
+++ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 08:09:23.949844566 +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); //
                                      //
 
...

@frobtech frobtech mentioned this pull request Dec 28, 2024
chapuni added a commit that referenced this pull request Dec 28, 2024
This reverts commit 5bec2b7.
(llvmorg-20-init-16425-g5bec2b71b44d)

This broke tests.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building clang-tools-extra at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 10:03:38.142479375 +0100
+++ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 10:03:38.382479375 +0100
@@ -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); //
                                      //
 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

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

Here is the relevant piece of the build log for the reference
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); //
                                      //
 
...

@chapuni
Copy link
Contributor

chapuni commented Dec 28, 2024

Excuse me, I've reverted this.

@4m4n-x-B4w4ne
Copy link
Contributor Author

4m4n-x-B4w4ne commented Dec 28, 2024

Excuse me, I've reverted this.

@chapuni Can you help on what thing , It went wrong and like ,What shall I need to do to make it done?

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 28, 2024

LLVM Buildbot has detected a new failure on builder clang-s390x-linux-lnt running on systemz-1 while building clang-tools-extra at step 7 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang Tools :: clang-tidy/checkers/readability/implicit-bool-conversion-check.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
Running ['clang-tidy', '/home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/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/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp failed:
--- /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.orig	2024-12-28 10:21:36.702389431 +0100
+++ /home/uweigand/sandbox/buildbot/clang-s390x-linux-lnt/stage1/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/implicit-bool-conversion-check.cpp.tmp.cpp	2024-12-28 10:21:36.772389431 +0100
@@ -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); //
                                      //
 
...

4m4n-x-B4w4ne added a commit to 4m4n-x-B4w4ne/llvm-project that referenced this pull request Jan 24, 2025
…20087)"

This reverts commit 5bec2b7.

reverting previous commits on this branch
@kaddkaka
Copy link

I'm interested in this configuration.

This was reverted after tests broke. What's the status on this now?

@chapuni do you have some inputs on how to do test verification before trying to merge this again?

@chapuni
Copy link
Contributor

chapuni commented Feb 13, 2025

@kaddkaka IIRC the issue was "char is unsigned". It could be reproducible with adding default target as failing targets above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to readability-implicit-bool-conversion check to allow implicit conversion *to bool*

9 participants