[clang] [Clang] Remove redundant check for scoped enums in shift operators (PR #152865)

2025-08-23 Thread Timothy Choi via cfe-commits
tinnamchoi wrote: @Sirraide The other PR got merged, this should be good upon green CI rerun https://github.com/llvm/llvm-project/pull/152865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-15 Thread Timothy Choi via cfe-commits
@@ -10742,9 +10742,53 @@ static void DiagnoseBadDivideOrRemainderValues(Sema& S, ExprResult &LHS, << IsDiv << RHS.get()->getSourceRange()); } +static void diagnoseScopedEnums(Sema &S, const SourceLocation Loc, +const

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-15 Thread Timothy Choi via cfe-commits
@@ -13,6 +13,7 @@ enum class E { e }; template int f(T t) { return ~t; } // expected-error {{invalid argument type}} template int f(T t, U u) { return t % u; } // expected-error {{invalid operands to}} + // e

[clang] [Clang] Remove redundant check for scoped enums in shift operators (PR #152865)

2025-08-10 Thread Timothy Choi via cfe-commits
tinnamchoi wrote: Agreed, let's wait for that then. https://github.com/llvm/llvm-project/pull/152865 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Remove redundant check for scoped enums in shift operators (PR #152865)

2025-08-10 Thread Timothy Choi via cfe-commits
tinnamchoi wrote: I prefer keeping my PRs atomic. All of my changes in that PR are necessary towards the primary goal of that PR, whereas this change wouldn't be. If I allowed myself to make refactors whenever I'm working on a feature it would introduce quite a bit of noise, which seems like a

[clang] [Clang] Remove redundant check for scoped enums in shift operators (PR #152865)

2025-08-09 Thread Timothy Choi via cfe-commits
tinnamchoi wrote: What would the tests in C look like? Scoped enums don't exist in C. Other than that, the tests to be introduced in #152698 should cover this, running locally seems fine. https://github.com/llvm/llvm-project/blob/45c8c060cc45cd3abfb3d4d4eda676ab6ce30890/clang/test/SemaCXX/enum

[clang] [Clang] Remove redundant check for scoped enums in shift operators (PR #152865)

2025-08-09 Thread Timothy Choi via cfe-commits
tinnamchoi wrote: The tests to be introduced in #152698 should cover this, running them locally seems fine. https://github.com/llvm/llvm-project/blob/45c8c060cc45cd3abfb3d4d4eda676ab6ce30890/clang/test/SemaCXX/enum-scoped.cpp#L439-L452 https://github.com/llvm/llvm-project/blob/45c8c060cc45cd3a

[clang] [Clang] Remove redundant check for scoped enums in shift operators (PR #152865)

2025-08-09 Thread Timothy Choi via cfe-commits
https://github.com/tinnamchoi created https://github.com/llvm/llvm-project/pull/152865 This check, introduced in 0bf3140424a0a13a928a4e6bf0f112e6167a5636, has not been necessary since 21673c4e7ec08457b53798b9879b7cc9a5909eb8 https://github.com/llvm/llvm-project/blob/0bf3140424a0a13a928a4e6bf0f

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-09 Thread Timothy Choi via cfe-commits
https://github.com/tinnamchoi updated https://github.com/llvm/llvm-project/pull/152698 >From 214a9541d4becd3dfae00cc33be5d35228455089 Mon Sep 17 00:00:00 2001 From: tinnamchoi Date: Fri, 8 Aug 2025 14:39:50 +0800 Subject: [PATCH 1/9] [Clang] Add diagnostic when scoped enumeration requires an e

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-09 Thread Timothy Choi via cfe-commits
https://github.com/tinnamchoi updated https://github.com/llvm/llvm-project/pull/152698 >From 214a9541d4becd3dfae00cc33be5d35228455089 Mon Sep 17 00:00:00 2001 From: tinnamchoi Date: Fri, 8 Aug 2025 14:39:50 +0800 Subject: [PATCH 1/8] [Clang] Add diagnostic when scoped enumeration requires an e

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-08 Thread Timothy Choi via cfe-commits
@@ -10772,9 +10811,14 @@ QualType Sema::CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, if (LHS.isInvalid() || RHS.isInvalid()) return QualType(); - - if (compType.isNull() || !compType->isArithmeticType()) -return InvalidOperands(Loc, LHS, RHS); + i

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-08 Thread Timothy Choi via cfe-commits
https://github.com/tinnamchoi edited https://github.com/llvm/llvm-project/pull/152698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-08 Thread Timothy Choi via cfe-commits
https://github.com/tinnamchoi edited https://github.com/llvm/llvm-project/pull/152698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add diagnostic when scoped enumeration requires an explicit conversion for binary operations (PR #152698)

2025-08-08 Thread Timothy Choi via cfe-commits
https://github.com/tinnamchoi created https://github.com/llvm/llvm-project/pull/152698 Fixes #24265 >From 214a9541d4becd3dfae00cc33be5d35228455089 Mon Sep 17 00:00:00 2001 From: tinnamchoi Date: Fri, 8 Aug 2025 14:39:50 +0800 Subject: [PATCH 1/3] [Clang] Add diagnostic when scoped enumeration