[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-30 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > LGTM! Failing docs build in precommit CI appears to be unrelated Hi, I don't have commit access, so I might need you to merge it for me :) https://github.com/llvm/llvm-project/pull/139429 ___ cfe-commits mailing list cfe-commits@li

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-30 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/139429 >From 0d2dcde90960b82364c0fa050be2a62b71d9d289 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Fri, 16 May 2025 09:17:40 -0400 Subject: [PATCH 1/4] Separate implicit int conversion on negation sign to new di

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-27 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: @cor3ntin Hi, sorry to bother, I think this is ready for review :) https://github.com/llvm/llvm-project/pull/139429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-16 Thread Yutong Zhu via cfe-commits
@@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -verify -Wimplicit-int-conversion +// RUN: %clang_cc1 %s -verify -Wimplicit-int-conversion -Wno-implicit-int-conversion-on-negation -DNO_DIAG + +#ifdef NO_DIAG +unsigned char test_no_diag(unsigned char x) { +return -x; // expected-no-d

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-16 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/139429 >From 0d2dcde90960b82364c0fa050be2a62b71d9d289 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Fri, 16 May 2025 09:17:40 -0400 Subject: [PATCH 1/2] Separate implicit int conversion on negation sign to new di

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-16 Thread Yutong Zhu via cfe-commits
@@ -12091,6 +12091,11 @@ void Sema::CheckImplicitConversion(Expr *E, QualType T, SourceLocation CC, if (SourceMgr.isInSystemMacro(CC)) return; +if (const auto *UO = dyn_cast(E)) { + return DiagnoseImpCast(*this, E, T, CC, + diag:

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-16 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/139429 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-16 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/139429 >From b5a1833d97a77692d25d3f60d347da62bd8db7c1 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Fri, 16 May 2025 09:12:40 -0400 Subject: [PATCH] Separate implicit int conversion on negation sign to new diagno

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-15 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/139429 >From e9e4634fa153a82a750360f0d41c65e2bfdf70cd Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Thu, 15 May 2025 17:41:21 -0400 Subject: [PATCH 1/2] Separate implicit int conversion on negation sign to new di

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

2025-05-15 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > If that warning is disruptive, maybe we should consider making it a separate > warning that people can disable independently? It is certainly a potential > source of bugs, so I'm not sure removing it entirely is the right approach > @AaronBallman H > If that warning is di

[clang] [Clang] Separate implicit int conversion on negation sign to new diagnostic group (PR #139429)

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

[clang] [Clang] Suppress a ``-Wimplicit-int-conversion``warning introduced in #126846 (PR #139429)

2025-05-15 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/139429 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-05-15 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > > unsigned int foo(unsigned char x) > > { > > return ~(1< > 'int' to 'unsigned int' > > } > > Could you help me understand why clang is emitting the warning? > > Isn't it semantically equivalent to the following code? > > ``` > unsigned int foo(unsigned char x) > { > i

[clang] [Clang] Suppress a ``-Wimplicit-int-conversion``warning introduced in #126846 (PR #139429)

2025-05-11 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu ready_for_review https://github.com/llvm/llvm-project/pull/139429 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Suppress a ``-Wimplicit-int-conversion``warning introduced in #126846 (PR #139429)

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

[clang] [Clang] Suppress a ``-Wimplicit-int-conversion``warning introduced in #126846 (PR #139429)

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

[clang] Suppress a ``-Wimplicit-int-conversion`` introduced in #126846 (PR #139429)

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

[clang] Make UO_Minus and UO_Not having the same logic in TryGetExprRange (PR #139429)

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

[clang] Make UO_Minus and UO_Not having the same logic in TryGetExprRange (PR #139429)

2025-05-10 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/139429 >From b3b1714c067ab830165cef7ee96867ffbe941caa Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 10 May 2025 22:11:03 -0400 Subject: [PATCH] Make UO_Minus and UO_Not having the same logic in TryGetExprRan

[clang] Make UO_Minus and UO_Not having the same logic in TryGetExprRange (PR #139429)

2025-05-10 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu created https://github.com/llvm/llvm-project/pull/139429 None >From 249f4ba50adf3ded14dd202ce15fdb7c7adb5e8d Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 10 May 2025 22:11:03 -0400 Subject: [PATCH] Make UO_Minus and UO_Not having the same logic in TryGetE

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: I believe this is ready :) https://github.com/llvm/llvm-project/pull/133653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu reopened https://github.com/llvm/llvm-project/pull/133653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH 1/6] Improved the -Wtautological-overlap-compare diagnostics to

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,san

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

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

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH 1/5] Improved the -Wtautological-overlap-compare diagnostics to

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
@@ -169,7 +169,84 @@ int struct_test(struct A a) { return a.x > 5 && a.y < 1; // no warning, different variables return a.x > 5 && a.x < 1; - // expected-warning@-1{{overlapping comparisons always evaluate to false}} + // expected-warning@-1{{non-overlapping comparisons

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-05-09 Thread Yutong Zhu via cfe-commits
@@ -1170,82 +1171,117 @@ class CFGBuilder { if (!areExprTypesCompatible(NumExpr1, NumExpr2)) return {}; +// Check that the two expressions are of the same type. Expr::EvalResult L1Result, L2Result; -if (!NumExpr1->EvaluateAsInt(L1Result, *Context) || -

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-04-13 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > > > But still I feel generate a warning for this case went too far. > > > > > > Yeah, that's probably right. Maybe for `-` on a signed operand, we should > > just return the original range with the `NonNegative` flag cleared out, and > > shouldn't add the extra bit for the

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-13 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH 1/4] Improved the -Wtautological-overlap-compare diagnostics to

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-12 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH 1/3] Improved the -Wtautological-overlap-compare diagnostics to

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-12 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH 1/2] Improved the -Wtautological-overlap-compare diagnostics to

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-12 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH] Improved the -Wtautological-overlap-compare diagnostics to warn

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-12 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH] Improved the -Wtautological-overlap-compare diagnostics to warn

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-12 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/133653 >From ca795c3f27e37ad8a8f165a3b10e9415cbfd66a5 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 12 Apr 2025 15:32:46 -0400 Subject: [PATCH] Improved the -Wtautological-overlap-compare diagnostics to warn

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-11 Thread Yutong Zhu via cfe-commits
@@ -70,13 +70,11 @@ static SourceLocation GetEndLoc(Decl *D) { return D->getLocation(); } -/// Returns true on constant values based around a single IntegerLiteral. -/// Allow for use of parentheses, integer casts, and negative signs. -/// FIXME: it would be good to unify th

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

2025-04-05 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu ready_for_review https://github.com/llvm/llvm-project/pull/133653 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Improve ``-Wtautological-overlap-compare`` diagnostics flag (PR #133653)

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

[clang] Improved the ``-Wtautological-overlap-compare`` diagnostics to warn a… (PR #133653)

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

[clang] Improved the ``-Wtautological-overlap-compare`` diagnostics to warn a… (PR #133653)

2025-03-30 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu created https://github.com/llvm/llvm-project/pull/133653 This PR attempts to improve the diagnostics flag ``-Wtautological-overlap-compare`` (#13473). I have added code to warn about float-point literals and character literals. I have also changed the warning mes

[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] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-19 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > I think this change might went too far. We are seeing this check flagging > code like this: > > ``` > error: implicit conversion loses integer precision: 'int' to 'int8_t' (aka > 'signed char') [-Werror,-Wimplicit-int-conversion]: > int8_t shift = ... > ... > shift = -shift

[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-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

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

2025-03-16 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu created https://github.com/llvm/llvm-project/pull/131523 This PR implements the feature request from issue #9500. From the original issue: ```c _Bool foo(void) { _Bool x = (void *)0; // warn on this return (void *)0; // warn on this } ``` However, I believe t

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-15 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > This had the side effect of adding implicit-int-conversion warnings on e.g. > the following code: > > ``` > unsigned char foo(unsigned char x) > { > return ~x; > } > ``` > > This seems correct, but this should probably be highlighted in the release > notes. > > Anothe

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

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

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

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

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-09 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > Can you update the first comment on this PR to reflect what you want to be in > the commit message? I notice that it doesn't describe what you're doing with > negation yet. Thanks! Hello, can you merge this or delete the review request I sent? This was due to an unsuccessf

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-09 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > Can you update the first comment on this PR to reflect what you want to be in > the commit message? I notice that it doesn't describe what you're doing with > negation yet. Thanks! Addressed https://github.com/llvm/llvm-project/pull/126846 _

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-07 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From 106a982e3c6bcfa3ee7c26133f0919791699f31a Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH 1/5] Fix signed-unsigned comparison with UO_Not and UO_Minus ---

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-07 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From 331ff18c3c3c3a16b7833e6c5299dc40cfacf694 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH] Fix signed-unsigned integer comparison diagnosis that contains

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-07 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH 1/4] Fix no warning for comparison of integers of different sign

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-07 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > @YutongZhuu Will you need someone to merge this for you? I think so. I don't think I have the permission to merge. https://github.com/llvm/llvm-project/pull/126846 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-03-06 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: Sorry, I accidentally requested for a review. Did not mean it. https://github.com/llvm/llvm-project/pull/126846 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-26 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH 1/2] Fix no warning for comparison of integers of different sign

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-26 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH] Fix no warning for comparison of integers of different signs --

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-23 Thread Yutong Zhu via cfe-commits
@@ -10069,6 +10069,17 @@ static std::optional TryGetExprRange(ASTContext &C, const Expr *E, case UO_AddrOf: // should be impossible return IntRange::forValueOfType(C, GetExprType(E)); +case UO_Not: { + std::optional SubRange = TryGetExprRange( + C,

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-23 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From d7404029e8998c8c8945cfaa34cf99b743ec2b70 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sun, 23 Feb 2025 18:16:06 -0500 Subject: [PATCH] Fix no warning for comparison of integers of different signs --

[clang] [Clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-13 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/126846 >From 44673ebf7c3fa773ffc7c52141b889c9ea352a93 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Tue, 11 Feb 2025 22:49:40 -0500 Subject: [PATCH] Force expressions with UO_Not to not be non-negative --- clang

[clang] Force expressions with UO_Not to not be non-negative (PR #126846)

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

[clang] Force expressions with UO_Not to not be non-negative (PR #126846)

2025-02-11 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu created https://github.com/llvm/llvm-project/pull/126846 Fix to issue #18878 This PR issues the bug of not throwing warning for the following code: ```c++ int test13(unsigned a, int *b) { return a > ~(95 != *b); // expected-warning {{comparison of integers

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-10 Thread Yutong Zhu via cfe-commits
@@ -121,6 +121,186 @@ Attribute Changes in Clang Improvements to Clang's diagnostics --- +- Some template related diagnostics have been improved. + + .. code-block:: c++ + + void foo() { template int i; } // error: templates can only be d

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-10 Thread Yutong Zhu via cfe-commits
@@ -121,6 +121,186 @@ Attribute Changes in Clang Improvements to Clang's diagnostics --- +- Some template related diagnostics have been improved. + + .. code-block:: c++ + + void foo() { template int i; } // error: templates can only be d

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/125370 >From 380ae2020f71cc5006db2e29b0a69f61297f585c Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 1 Feb 2025 20:09:13 -0500 Subject: [PATCH 1/3] Force AttributedStmtClass to not be scope parents --- clang

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-09 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/125370 >From 380ae2020f71cc5006db2e29b0a69f61297f585c Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 1 Feb 2025 20:09:13 -0500 Subject: [PATCH 1/2] Force AttributedStmtClass to not be scope parents --- clang

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-08 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > Could you add a test case - check in clang/test to see if other tests for the > diagnostic text in the original bug, and add a test case for that nearby > (maybe the same file the diagnostic is already tested in)? Done https://github.com/llvm/llvm-project/pull/125370 _

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-07 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/125370 >From 380ae2020f71cc5006db2e29b0a69f61297f585c Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 1 Feb 2025 20:09:13 -0500 Subject: [PATCH 1/2] Force AttributedStmtClass to not be scope parents --- clang

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-07 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu updated https://github.com/llvm/llvm-project/pull/125370 >From 380ae2020f71cc5006db2e29b0a69f61297f585c Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 1 Feb 2025 20:09:13 -0500 Subject: [PATCH] Force AttributedStmtClass to not be scope parents --- clang/doc

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

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

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

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

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

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

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-04 Thread Yutong Zhu via cfe-commits
YutongZhuu wrote: > Could you add a test case - check in clang/test to see if other tests for the > diagnostic text in the original bug, and add a test case for that nearby > (maybe the same file the diagnostic is already tested in)? Do you mean I should check if there exists a test for the or

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

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

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-04 Thread Yutong Zhu via cfe-commits
@@ -658,7 +649,13 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, Next = SC->getSubStmt(); else if (LabelStmt *LS = dyn_cast(SubStmt)) Next = LS->getSubStmt(); - else + else if (AttributedStmt *AS = dyn_cast(SubStmt)) { +if (GetM

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

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

[clang] [clang] Force AttributedStmtClass to not be scope parents (PR #125370)

2025-02-01 Thread Yutong Zhu via cfe-commits
https://github.com/YutongZhuu created https://github.com/llvm/llvm-project/pull/125370 This PR addresses https://github.com/llvm/llvm-project/issues/84072. >From 01497e746ae23ea5033b1c6cd6f9f9718d6dc3d6 Mon Sep 17 00:00:00 2001 From: Yutong Zhu Date: Sat, 1 Feb 2025 20:09:13 -0500 Subject: [PA