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

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