[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-20 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Can you tell why there is false positive with structured bindings only, but without variables? https://github.com/llvm/llvm-project/pull/157667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-20 Thread Yanzuo Liu via cfe-commits
@@ -8496,6 +8498,21 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, ->ShadowingDecls.push_back({D, VD}); return; } +} else if (isa(ShadowedDecl)) { + // Apply lambda capture logic only when D is actually a

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-20 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: Thanks! It looks better. Please add a release note entry to "clang/docs/ReleaseNotes.rst". https://github.com/llvm/llvm-project/pull/157667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang-tools-extra] [Clangd] [NFC] Fix dereference of null value (PR #159566)

2025-09-18 Thread Yanzuo Liu via cfe-commits
@@ -145,8 +145,11 @@ std::string getQualification(ASTContext &Context, for (const auto *CurD : llvm::reverse(Parents)) { if (auto *TD = llvm::dyn_cast(CurD)) { QualType T; - if (const auto *RD = dyn_cast(TD); zwuis wrote: I think changing `dyn

[clang] [Clang][Sema] Make lambda in non-dependent context generate same analysis-based warnings as function[ template] (PR #159364)

2025-09-17 Thread Yanzuo Liu via cfe-commits
@@ -178,3 +178,41 @@ auto b() { } } // namespace test6 #endif + +#if __cplusplus >= 201402L +// ensure lambda in non-dependent context generate same diagnostics as function[ template] +namespace lambda_in_non_dependent_context { +void f1() { + 0, 0; // expected-warning {{left

[clang] [Clang][Sema] Make lambda in non-dependent context generate same analysis-based warnings as function[ template] (PR #159364)

2025-09-17 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/159364 >From 06b010d27dcfbd3a03453d6aab04f854ed734891 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Wed, 17 Sep 2025 21:54:01 +0800 Subject: [PATCH 1/2] Make lambda in non-dependent context generate same analysis-base

[clang-tools-extra] [clang-tidy] improve robustness of the member initializer detection in modernize-use-default-member-init (PR #159392)

2025-09-17 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/159392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] improve robustness of the member initializer detection in modernize-use-default-member-init (PR #159392)

2025-09-17 Thread Yanzuo Liu via cfe-commits
@@ -8,17 +8,52 @@ #include "UseDefaultMemberInitCheck.h" #include "clang/AST/ASTContext.h" +#include "clang/AST/Expr.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" #include "clang/Lex/Lexer.h" using namespace clang::ast_matche

[clang-tools-extra] [clang-tidy] improve robustness of the member initializer detection in modernize-use-default-member-init (PR #159392)

2025-09-17 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: > Fixed #156295, #122480 Linked issue | Syntax | Example --- | -- | -- Multiple issues | Use full syntax for each issue | `Resolves #10, resolves #123, resolves octo-org/octo-repo#100` https://docs.github.com/en/issues/tracking-your-work-

[clang] [Clang][Sema] Make lambda in non-dependent context generate same analysis-based warnings as function[ template] (PR #159364)

2025-09-17 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/159364 This patch fixes following two issues: - When handling warnings which should be emitted if reachable, expressions in global lambdas aren't treated as if in functions, so warnings are emitted immediately without

[clang] [clang] Allow attributes on first constructor argument in pre-C++11 (PR #157300)

2025-09-15 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/157300 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add the candiscard attribute to suppress nodiscard (PR #154943)

2025-09-14 Thread Yanzuo Liu via cfe-commits
zwuis wrote: > I don't know what an RFC is. https://clang.llvm.org/get_involved.html#criteria https://github.com/llvm/llvm-project/pull/154943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-13 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/157667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-12 Thread Yanzuo Liu via cfe-commits
zwuis wrote: LGTM if PR description is updated. https://github.com/llvm/llvm-project/pull/157667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-12 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,100 @@ + +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] [llvm] [ADT] Add and use (for AArch64) `ValueOrSentinel` (PR #158120)

2025-09-12 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,86 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apac

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-12 Thread Yanzuo Liu via cfe-commits
@@ -8508,10 +8525,17 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, return; } } - if (const auto *VD = dyn_cast(ShadowedDecl); - VD && VD->hasLocalStorage()) { -// A variable can't shadow a local variable in an en

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-12 Thread Yanzuo Liu via cfe-commits
@@ -8508,10 +8525,17 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, return; } } - if (const auto *VD = dyn_cast(ShadowedDecl); - VD && VD->hasLocalStorage()) { -// A variable can't shadow a local variable in an en

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-12 Thread Yanzuo Liu via cfe-commits
zwuis wrote: IIUC we shouldn't emit any warning on "lambda captures shadow something". It is a better approach for me that removing emitting this warning and performing code cleanup (there must be some checks preventing false positive with shadowing variables). https://github.com/llvm/llvm-pr

[clang] [clang][Sema] Fix false positive -Wshadow with structured binding captures (PR #157667)

2025-09-12 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Oh, I missed "-Wshadow-uncaptured-local". Thanks for pointing out! > IIUC we shouldn't emit any warning on "lambda captures shadow something". It > is a better approach for me that removing emitting this warning and > performing code cleanup (there must be some checks preventing f

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-07 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/155982 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-07 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Thank you for your review! https://github.com/llvm/llvm-project/pull/155982 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-07 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/155982 >From 426caa9f66cddd1deac23b397baf75f6809f6f52 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Fri, 29 Aug 2025 15:15:24 +0800 Subject: [PATCH 1/6] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-07 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,100 @@ + +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang] [clang] Detect int-to-float narrowing when the back-conversion is unspecified (PR #157174)

2025-09-07 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Thank you for your patch! Please add a release note entry to `clang/docs/ReleaseNotes.rst` so that users can know the improvement. https://github.com/llvm/llvm-project/pull/157174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [clang] Add the candiscard attribute to suppress nodiscard (PR #154943)

2025-09-07 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Is an RFC required? CC @cor3ntin https://github.com/llvm/llvm-project/pull/154943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Add test for CWG2289 "Uniqueness of structured binding names" (PR #131054)

2025-09-07 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/131054 >From 4b21efb204f8bc0523b162dc22fc490d45cb52f3 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Thu, 13 Mar 2025 10:00:37 +0800 Subject: [PATCH] Add test for cwg2289 --- clang/test/CXX/drs/cwg22xx.cpp | 12 ++

[clang] [clang] Allow attributes on first constructor argument in pre-C++11 (PR #157300)

2025-09-07 Thread Yanzuo Liu via cfe-commits
@@ -324,6 +324,8 @@ Bug Fixes to Attribute Support is skipped, such as error recovery and code completion. (#GH153551) - Using ``[[gnu::cleanup(some_func)]]`` where some_func is annotated with ``[[gnu::error("some error")]]`` now correctly triggers an error. (#GH146520) +-

[clang] [clang] Detect int-to-float narrowing when the back-conversion is unspecified (PR #157174)

2025-09-07 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/157174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-06 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,100 @@ + +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: A

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/157213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Detect int-to-float narrowing when the back-conversion is unspecified (PR #157174)

2025-09-06 Thread Yanzuo Liu via cfe-commits
@@ -308,6 +308,8 @@ Bug Fixes in This Version - Builtin elementwise operators now accept vector arguments that have different qualifiers on their elements. For example, vector of 4 ``const float`` values and vector of 4 ``float`` values. (#GH155405) +- Fix the check for nar

[clang] [clang] Detect int-to-float narrowing when the back-conversion is unspecified (PR #157174)

2025-09-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis approved this pull request. https://github.com/llvm/llvm-project/pull/157174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Detect int-to-float narrowing when the back-conversion is unspecified (PR #157174)

2025-09-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/157174 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-06 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/157213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Detect int-to-float narrowing when the back-conversion is unspecified (PR #157174)

2025-09-06 Thread Yanzuo Liu via cfe-commits
@@ -412,10 +412,12 @@ NarrowingKind StandardConversionSequence::getNarrowingKind( // And back. llvm::APSInt ConvertedValue = *IntConstantValue; bool ignored; -Result.convertToInteger(ConvertedValue, -llvm::APFloat

[clang] [clang] Detect int-to-float narrowing when the back-conversion is unspecified (PR #157174)

2025-09-06 Thread Yanzuo Liu via cfe-commits
@@ -308,6 +308,8 @@ Bug Fixes in This Version - Builtin elementwise operators now accept vector arguments that have different qualifiers on their elements. For example, vector of 4 ``const float`` values and vector of 4 ``float`` values. (#GH155405) +- Fix the check for nar

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-06 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,80 @@ + +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: > Adressing GH-155922. You can add `Fix GH-155922`or something like this to PR description so that the issue will be closed when the PR is merged. See

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-05 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,80 @@ + +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/157213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/157213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-05 Thread Yanzuo Liu via cfe-commits
@@ -0,0 +1,80 @@ + +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] Add bugprone-loop-variable-copied-then-modified clang-tidy check. (PR #157213)

2025-09-05 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/157213 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Add test for CWG2289 "Uniqueness of structured binding names" (PR #131054)

2025-09-05 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Ping @Endilll Are you happy with current PR description? https://github.com/llvm/llvm-project/pull/131054 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-03 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/155982 >From 426caa9f66cddd1deac23b397baf75f6809f6f52 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Fri, 29 Aug 2025 15:15:24 +0800 Subject: [PATCH 1/5] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-03 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/155982 >From 426caa9f66cddd1deac23b397baf75f6809f6f52 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Fri, 29 Aug 2025 15:15:24 +0800 Subject: [PATCH 1/4] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-03 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/155982 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-03 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/155982 >From 426caa9f66cddd1deac23b397baf75f6809f6f52 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Fri, 29 Aug 2025 15:15:24 +0800 Subject: [PATCH 1/4] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-09-02 Thread Yanzuo Liu via cfe-commits
@@ -76,6 +136,16 @@ bool foo(Y *y, Z *z) { // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: isa_and_nonnull<> is preferred // CHECK-FIXES: if (isa_and_nonnull(z->bar())) + if (z->bar() && cast_or_null(z->bar())) +return true; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning:

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-08-30 Thread Yanzuo Liu via cfe-commits
@@ -76,6 +136,16 @@ bool foo(Y *y, Z *z) { // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: isa_and_nonnull<> is preferred // CHECK-FIXES: if (isa_and_nonnull(z->bar())) + if (z->bar() && cast_or_null(z->bar())) +return true; + // CHECK-MESSAGES: :[[@LINE-2]]:7: warning:

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-08-30 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/155982 >From 426caa9f66cddd1deac23b397baf75f6809f6f52 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Fri, 29 Aug 2025 15:15:24 +0800 Subject: [PATCH 1/3] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-08-30 Thread Yanzuo Liu via cfe-commits
zwuis wrote: > Did you try running on LLVM code to check for any miscodegen/FP? > https://clang.llvm.org/extra/clang-tidy/#running-clang-tidy-in-parallel I just finished checking using `compile_commands.json` generated with `-DLLVM_ENABLE_PROJECTS=bolt;clang;clang-tools-extra;lld;lldb:mlir;pol

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-08-30 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/155982 >From 426caa9f66cddd1deac23b397baf75f6809f6f52 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Fri, 29 Aug 2025 15:15:24 +0800 Subject: [PATCH 1/2] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-

[clang-tools-extra] [Clang-Tidy] Handle nested-name-specifier in "llvm-prefer-isa-or-dyn-cast-in-conditionals" (PR #155982)

2025-08-29 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/155982 Use `declRefExpr` matcher to match callee so that we can get the `SourceRange` of the identifier of the callee for replacement. Drive-by changes: - Use `hasConditionVariableStatement` matcher to handle `if` stat

[clang] [clang][bytecode] Lazily create DynamicAllocator (PR #155831)

2025-08-28 Thread Yanzuo Liu via cfe-commits
@@ -164,7 +170,7 @@ class InterpState final : public State, public SourceMapper { /// Reference to the offset-source mapping. SourceMapper *M; /// Allocator used for dynamic allocations performed via the program. - DynamicAllocator Alloc; + std::unique_ptr Alloc; -

[clang] [clang] Update typechecking of builtin elementwise ternary math operators (PR #155620)

2025-08-27 Thread Yanzuo Liu via cfe-commits
@@ -15884,6 +15884,58 @@ static bool checkBuiltinVectorMathMixedEnums(Sema &S, Expr *LHS, Expr *RHS, return false; } +/// Check if all arguments have the same type. If the types don't match, emit an +/// error message and return true. Otherwise return false. +/// +/// For

[clang] [clang-tools-extra] [clang] Heuristic resolution for explicit object parameter (PR #155143)

2025-08-26 Thread Yanzuo Liu via cfe-commits
@@ -301,9 +302,34 @@ std::vector HeuristicResolverImpl::resolveMemberExpr( return {}; } + // check if member expr is in the context of an explicit object method + // If so, it's safe to assume the templated arg is of type of the record + const auto ExplicitMemberHeur

[clang] [clang-tools-extra] [clang] Heuristic resolution for explicit object parameter (PR #155143)

2025-08-24 Thread Yanzuo Liu via cfe-commits
@@ -301,9 +302,34 @@ std::vector HeuristicResolverImpl::resolveMemberExpr( return {}; } + // check if member expr is in the context of an explicit object method + // If so, it's safe to assume the templated arg is of type of the record + const auto ExplicitMemberHeur

[clang] [clang-tools-extra] [clang] Heuristic resolution for explicit object parameter (PR #155143)

2025-08-24 Thread Yanzuo Liu via cfe-commits
@@ -301,9 +302,34 @@ std::vector HeuristicResolverImpl::resolveMemberExpr( return {}; } + // check if member expr is in the context of an explicit object method + // If so, it's safe to assume the templated arg is of type of the record + const auto ExplicitMemberHeur

[clang] [clang-tools-extra] [clang] Heuristic resolution for explicit object parameter (PR #155143)

2025-08-24 Thread Yanzuo Liu via cfe-commits
@@ -301,9 +302,34 @@ std::vector HeuristicResolverImpl::resolveMemberExpr( return {}; } + // check if member expr is in the context of an explicit object method + // If so, it's safe to assume the templated arg is of type of the record + const auto ExplicitMemberHeur

[clang] [clang-tools-extra] [clang] Heuristic resolution for explicit object parameter (PR #155143)

2025-08-24 Thread Yanzuo Liu via cfe-commits
@@ -301,9 +302,34 @@ std::vector HeuristicResolverImpl::resolveMemberExpr( return {}; } + // check if member expr is in the context of an explicit object method + // If so, it's safe to assume the templated arg is of type of the record + const auto ExplicitMemberHeur

[clang] [clang-tools-extra] [clang] Heuristic resolution for explicit object parameter (PR #155143)

2025-08-24 Thread Yanzuo Liu via cfe-commits
@@ -301,9 +302,34 @@ std::vector HeuristicResolverImpl::resolveMemberExpr( return {}; } + // check if member expr is in the context of an explicit object method + // If so, it's safe to assume the templated arg is of type of the record + const auto ExplicitMemberHeur

[clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)

2025-08-23 Thread Yanzuo Liu via cfe-commits
@@ -95,24 +95,25 @@ TC https://github.com/llvm/llvm-project/pull/155120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Do not trigger -Wmissing-noreturn on lambdas prior to C++23 (PR #154545)

2025-08-20 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/154545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statements (PR #154298)

2025-08-20 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/154298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statements (PR #154298)

2025-08-20 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Thank you for your review! https://github.com/llvm/llvm-project/pull/154298 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statements (PR #154298)

2025-08-20 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/154298 >From 14102c2c5bbd5c4caa9049f87699cce82cdc4481 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Tue, 19 Aug 2025 17:29:18 +0800 Subject: [PATCH 1/2] Make `hasConditionVariableStatement` support `for` loop, `while`

[clang] Do not trigger -Wmissing-noreturn on lambdas prior to C++23 (PR #154545)

2025-08-20 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/154545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Do not trigger -Wmissing-noreturn on lambdas prior to C++23 (PR #154545)

2025-08-20 Thread Yanzuo Liu via cfe-commits
@@ -16,6 +17,16 @@ void throwError(const std::string& msg) { // expected-warning {{function 'throwE throw std::runtime_error(msg); } +// We cannot use the [[noreturn]] attribute on lambdas until C++23 +void lambda(const std::string& msg) { +#if __cplusplus >= 202302L + aut

[clang] Do not trigger -Wmissing-noreturn on lambdas prior to C++23 (PR #154545)

2025-08-20 Thread Yanzuo Liu via cfe-commits
@@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -fexceptions -Wreturn-type -Wmissing-noreturn -verify %s +// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -fexceptions -Wreturn-type -Wmissing-noreturn -verify -std=c++17 %s zwuis wrote: We ca

[clang] Skip test added in #154418 to work when the default is C++20. (PR #154463)

2025-08-19 Thread Yanzuo Liu via cfe-commits
zwuis wrote: We can add `-std=c++17` and change `-verify` to `-verify=expected,cxx17` so that we can use `// cxx17-warning {{...}}` instead of adding `#if` block for some test cases. See . https://gith

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statement (PR #154298)

2025-08-19 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/154298 >From 14102c2c5bbd5c4caa9049f87699cce82cdc4481 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Tue, 19 Aug 2025 17:29:18 +0800 Subject: [PATCH 1/2] Make `hasConditionVariableStatement` support `for` loop, `while`

[clang] [Clang][ASTMatchers] Make `hasConditionVariableStatement` support `for` loop, `while` loop and `switch` statement (PR #154298)

2025-08-19 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/154298 None >From 14102c2c5bbd5c4caa9049f87699cce82cdc4481 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Tue, 19 Aug 2025 17:29:18 +0800 Subject: [PATCH] Make `hasConditionVariableStatement` support `for` loop, `whil

[clang] Fix lambda *this capture crash - Fixes #154054 (PR #154057)

2025-08-17 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Where is the fix? Only test file is modified currently. https://github.com/llvm/llvm-project/pull/154057 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix incompatible pointer to integer conversion error in array initialization - Fixes #154046 (PR #154061)

2025-08-17 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Do you know the issue is compiler crash? https://github.com/llvm/llvm-project/pull/154061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] [lld] [llvm] [LLVM][utils] Add script which clears release notes (PR #153593)

2025-08-15 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/153593 ___ 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-15 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Please move fix-it test to `clang/test/FixIt` folder. https://github.com/llvm/llvm-project/pull/152698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

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

2025-08-15 Thread Yanzuo Liu via cfe-commits
@@ -4401,6 +4401,11 @@ def warn_impcast_different_enum_types : Warning< def warn_impcast_int_to_enum : Warning< "implicit conversion from %0 to enumeration type %1 is invalid in C++">, InGroup, DefaultIgnore; + +def note_no_implicit_conversion_for_scoped_enum +: Note<"n

[clang] [clang-tools-extra] [flang] [lld] [llvm] [LLVM][utils] Add script which clears release notes (PR #153593)

2025-08-15 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Thank you for your review! > @zwuis do you need someone to merge the PR for you? I can merge the PR by myself :) https://github.com/llvm/llvm-project/pull/153593 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang] [clang-tools-extra] [flang] [lld] [llvm] [LLVM][utils] Add script which clears release notes (PR #153593)

2025-08-15 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/153593 >From 1fdf80aac85fdade340ac8ae17519a0b4d68d0f7 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Thu, 14 Aug 2025 23:01:41 +0800 Subject: [PATCH 1/4] Add script to clear release notes --- clang-tools-extra/docs/Re

[clang] [clang-tools-extra] [flang] [lld] [llvm] [LLVM][utils] Add script which clears release notes (PR #153593)

2025-08-14 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/153593 >From 1fdf80aac85fdade340ac8ae17519a0b4d68d0f7 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Thu, 14 Aug 2025 23:01:41 +0800 Subject: [PATCH 1/3] Add script to clear release notes --- clang-tools-extra/docs/Re

[clang] [clang-tools-extra] [flang] [lld] [llvm] [LLVM][utils] Add script which clears release notes (PR #153593)

2025-08-14 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/153593 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [flang] [lld] [llvm] [LLVM][utils] Add script to clear release notes (PR #153593)

2025-08-14 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis updated https://github.com/llvm/llvm-project/pull/153593 >From 1fdf80aac85fdade340ac8ae17519a0b4d68d0f7 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Thu, 14 Aug 2025 23:01:41 +0800 Subject: [PATCH 1/2] Add script to clear release notes --- clang-tools-extra/docs/Re

[clang] [clang-tools-extra] [flang] [lld] [llvm] [LLVM][utils] Add script to clear release notes (PR #153593)

2025-08-14 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/153593 The script copies `ReleaseNotesTemplate.txt` to corresponding `ReleaseNotes.rst`/`.md` to clear release notes. The suffix of `ReleaseNotesTemplate.txt` must be `.txt`. If it is `.rst`/`.md`, it will be treated a

[clang-tools-extra] [clangd] extend and rearrange doxygen hover documentation (PR #152918)

2025-08-10 Thread Yanzuo Liu via cfe-commits
@@ -263,8 +264,76 @@ class BlockCommentToMarkupDocument StringRef CommentEscapeMarker; }; -void SymbolDocCommentVisitor::parameterDocToMarkup(StringRef ParamName, - markup::Paragraph &Out) { +void SymbolDocCommentVisitor::vis

[clang-tools-extra] [clangd] extend and rearrange doxygen hover documentation (PR #152918)

2025-08-10 Thread Yanzuo Liu via cfe-commits
@@ -135,7 +135,11 @@ std::string getDeclComment(const ASTContext &Ctx, const NamedDecl &Decl) { std::string RawDoc; llvm::raw_string_ostream OS(RawDoc); -V.parameterDocToString(dyn_cast(&Decl)->getName(), OS); +if (isa(Decl)) + V.parameterDocToString(dyn_

[clang-tools-extra] [clangd] extend and rearrange doxygen hover documentation (PR #152918)

2025-08-10 Thread Yanzuo Liu via cfe-commits
@@ -112,7 +112,7 @@ std::string getDeclComment(const ASTContext &Ctx, const NamedDecl &Decl) { std::string Doc; if (Cfg.Documentation.CommentFormat == Config::CommentFormatPolicy::Doxygen && - isa(Decl)) { + (isa(Decl) || isa(Decl))) { zwuis wr

[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-09 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis approved this pull request. https://github.com/llvm/llvm-project/pull/152809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add detailed notes explaining why is_aggregate evaluates to false (PR #152488)

2025-08-09 Thread Yanzuo Liu via cfe-commits
@@ -2595,6 +2596,105 @@ static void DiagnoseNonStandardLayoutReason(Sema &SemaRef, SourceLocation Loc, SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D; } +static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc, +

[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-08 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis approved this pull request. Thanks! https://github.com/llvm/llvm-project/pull/152809 ___ 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 Yanzuo Liu via cfe-commits
https://github.com/zwuis 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 Yanzuo Liu 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 Yanzuo Liu via cfe-commits
@@ -4401,6 +4401,11 @@ def warn_impcast_different_enum_types : Warning< def warn_impcast_int_to_enum : Warning< "implicit conversion from %0 to enumeration type %1 is invalid in C++">, InGroup, DefaultIgnore; + +def note_no_implicit_conversion_for_scoped_enum +: Note<"n

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

2025-08-08 Thread Yanzuo Liu via cfe-commits
@@ -1,5 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify -triple x86_64-apple-darwin %s // RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++17 -verify -triple x86_64-apple-darwin %s zwuis wrote: We can change `-verify` to `-verify=expected

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

2025-08-08 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis commented: Thank you for your patch! Please add fix-it test. And please add a release note entry to `clang/docs/ReleaseNotes.rst` so that users can know the improvement. https://github.com/llvm/llvm-project/pull/152698 ___ cfe

[clang] [Clang][NFC] Enumerate Clang ABI versions in a separate header file (PR #151995)

2025-08-07 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis closed https://github.com/llvm/llvm-project/pull/151995 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Enumerate Clang ABI versions in a separate header file (PR #151995)

2025-08-07 Thread Yanzuo Liu via cfe-commits
zwuis wrote: Thank you for your review! https://github.com/llvm/llvm-project/pull/151995 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Enumerate Clang abi versions in a separate header file (PR #151995)

2025-08-04 Thread Yanzuo Liu via cfe-commits
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/151995 Make it easier for us to add abi versions. Close #144332 >From 8881838e71226a31f06333ef55a73718f32b Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Tue, 5 Aug 2025 00:19:53 +0800 Subject: [PATCH] Enumerate C

[clang] Fix crash when doing special member lookup on forward-declared classes (Fixes llvm/llvm-project#144642) (PR #144828)

2025-08-04 Thread Yanzuo Liu via cfe-commits
zwuis wrote: > Hi! I want to close this PR. What do I need to do? You can just close this PR. https://github.com/llvm/llvm-project/pull/144828 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

  1   2   3   4   >