[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-19 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu converted_to_draft https://github.com/llvm/llvm-project/pull/131523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-17 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I can't for the life of me see a good way to use this. The `if(p)` pattern is > so common that no code base could ever turn on this warning. We could PERHAPS > check that we're in the process of checking a condition expression and > suppress this diagnostic, or recognize

[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-17 Thread Erich Keane via cfe-commits
erichkeane wrote: > > I can't for the life of me see a good way to use this. The `if(p)` pattern > > is so common that no code base could ever turn on this warning. We could > > PERHAPS check that we're in the process of checking a condition expression > > and suppress this diagnostic, or reco

[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-17 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > I can't for the life of me see a good way to use this. The `if(p)` pattern > is so common that no code base could ever turn on this warning. We could > PERHAPS check that we're in the process of checking a condition expression > and suppress this diagnostic, or recognize

[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-17 Thread Erich Keane via cfe-commits
erichkeane wrote: I can't for the life of me see a good way to use this. The `if(p)` pattern is so common that no code base could ever turn on this warning. We could PERHAPS check that we're in the process of checking a condition expression and suppress this diagnostic, or recognize this pat

[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-16 Thread via cfe-commits
hstk30-hw wrote: We have so many conversion from ptr to bool like null check stmt `if (!p) ...` . Open the option will get many warnings, and can't figure out the real case from it. https://github.com/llvm/llvm-project/pull/131523 ___ cfe-commits ma

[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-16 Thread via cfe-commits
MagentaTreehouse wrote: We should not flag [contextual conversions](https://en.cppreference.com/w/cpp/language/implicit_conversion#Contextual_conversions) to `bool`. This is supported by C++ Core Guidelines [ES.87: Don’t add redundant `==` or `!=` conditions](https://isocpp.github.io/CppCoreG

[clang] [Clang]Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-16 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu edited https://github.com/llvm/llvm-project/pull/131523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-16 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu edited https://github.com/llvm/llvm-project/pull/131523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang]Implement Wpointer-bool-conversion-strict (PR #131523)

2025-03-16 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/131523 >From f99d61ef3353e8559450e91ad8201f8fe7592a86 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 16 Mar 2025 11:15:31 -0400 Subject: [PATCH 1/2] Implement Wpointer-bool-conversion-strict --- clang/docs/R