[clang-tools-extra] [clang-tidy] New bugprone-derived-method-shadowing-base-method (PR #154746)

2025-08-29 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,132 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] New bugprone-derived-method-shadowing-base-method (PR #154746)

2025-08-29 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,127 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] New bugprone-derived-method-shadowing-base-method (PR #154746)

2025-08-29 Thread Victor Chernyakin via cfe-commits
@@ -153,6 +154,8 @@ class BugproneModule : public ClangTidyModule { "bugprone-incorrect-enable-if"); CheckFactories.registerCheck( "bugprone-incorrect-enable-shared-from-this"); +CheckFactories.registerCheck( +"bugprone-derived-method-shadowing-b

[clang-tools-extra] [clang-tidy] New bugprone-derived-method-shadowing-base-method (PR #154746)

2025-08-29 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,127 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] New bugprone-derived-method-shadowing-base-method (PR #154746)

2025-08-29 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,127 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] New bugprone-derived-method-shadowing-base-method (PR #154746)

2025-08-29 Thread Victor Chernyakin via cfe-commits
@@ -31,6 +31,7 @@ add_clang_library(clangTidyBugproneModule STATIC IncorrectEnableIfCheck.cpp IncorrectEnableSharedFromThisCheck.cpp InvalidEnumDefaultInitializationCheck.cpp + DerivedMethodShadowingBaseMethodCheck.cpp localspook wrote: Ditto alphabetic

[clang-tools-extra] [clang-tidy] New bugprone-derived-method-shadowing-base-method (PR #154746)

2025-08-29 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,127 @@ +//===--===// +// +// 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: Apa

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-26 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,162 @@ +// TODO: When Clang adds support for decimal floating point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. + +// RUN: %c

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/148275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-26 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,162 @@ +// TODO: When Clang adds support for decimal floating point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. + +// RUN: %c

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/148275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-26 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,162 @@ +// TODO: When Clang adds support for decimal floating point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. + +// RUN: %c

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-25 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/148275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-25 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/148275 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-25 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/148275 >From b19ad9cda58288d727861bdd0a9d2a7cedc7c1a6 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Fri, 11 Jul 2025 11:35:50 -0700 Subject: [PATCH 1/6] [clang-tidy] Teach `readability-uppercase-literal-suf

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-25 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,248 @@ +// TODO: When Clang adds support for C++23 floating-point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. +// These suffi

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-25 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,248 @@ +// TODO: When Clang adds support for C++23 floating-point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. +// These suffi

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-08-25 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/148275 >From b19ad9cda58288d727861bdd0a9d2a7cedc7c1a6 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Fri, 11 Jul 2025 11:35:50 -0700 Subject: [PATCH 1/5] [clang-tidy] Teach `readability-uppercase-literal-suf

[clang-tools-extra] [clang-tidy][NFC] clean up some matchers in `modernize-type-traits` (PR #155180)

2025-08-24 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook closed https://github.com/llvm/llvm-project/pull/155180 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][NFC] clean up some matchers in `modernize-type-traits` (PR #155180)

2025-08-24 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/155180 `dependentNameTypeLoc` is unused. `dependentScopeDeclRefExpr` has appeared in `ASTMatchers.h` since this code was written. >From d4e27d738a71c1a9b0f2b699f41e74b3a8a41366 Mon Sep 17 00:00:00 2001 From: Victor

[clang-tools-extra] [clang-tidy] Mark bunch of checks as C++-only (PR #155083)

2025-08-23 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook closed https://github.com/llvm/llvm-project/pull/155083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-23 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook closed https://github.com/llvm/llvm-project/pull/152938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-08-23 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook closed https://github.com/llvm/llvm-project/pull/150791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-08-23 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/150791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Mark bunch of checks as C++-only (PR #155083)

2025-08-23 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/155083 Hope I got them all... >From 2e397d72b35e85d80da270f5509b9d2278770307 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 23 Aug 2025 01:54:21 -0700 Subject: [PATCH] [clang-tidy] Mark bunch of checks

[clang-tools-extra] [clang-tidy] Ignore default ctor with user provided argument in `readability-container-size-empty` (PR #154782)

2025-08-22 Thread Victor Chernyakin via cfe-commits
@@ -190,7 +190,7 @@ void ContainerSizeEmptyCheck::registerMatchers(MatchFinder *Finder) { const auto WrongComparend = anyOf(stringLiteral(hasSize(0)), userDefinedLiteral(hasLiteral(stringLiteral(hasSize(0, -cxxConstructExpr(isDefaultConstruc

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-08-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/150791 >From 20eb165f1abd9bf7976a2c401579a1284258e13e Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 26 Jul 2025 11:52:19 -0700 Subject: [PATCH 1/6] [clang-tidy] Stop ignoring `-std` argument in `check

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-08-20 Thread Victor Chernyakin via cfe-commits
@@ -374,15 +373,23 @@ def parse_arguments() -> Tuple[argparse.Namespace, List[str]]: parser.add_argument( "-std", type=csv, -default=["c++11-or-later"], +default=None, help="Passed to clang. Special -or-later values are expanded.",

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-08-18 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/150791 >From 20eb165f1abd9bf7976a2c401579a1284258e13e Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 26 Jul 2025 11:52:19 -0700 Subject: [PATCH 1/5] [clang-tidy] Stop ignoring `-std` argument in `check

[clang] [clang][Sema] Diagnose passing function pointer to `__builtin_assume_aligned` (PR #153552)

2025-08-14 Thread Victor Chernyakin via cfe-commits
@@ -1,9 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -Wno-int-conversion -triple x86_64-linux -verify %s localspook wrote: The pointer is now always converted to `const void *`, so we no longer need to disallow these integer conversions. https://github.com/llvm/l

[clang] [clang][Sema] Diagnose passing function pointer to `__builtin_assume_aligned` (PR #153552)

2025-08-14 Thread Victor Chernyakin via cfe-commits
localspook wrote: I've switched to `checkBuiltinArgument`, but it causes an issue that I'd like input on before I continue. `clang/test/CodeGen/catch-alignment-assumption-ignorelist.c` tests that UBSan doesn't validate the alignment of pointers to volatile. With this change, the `volatile`-ne

[clang] [clang][Sema] Diagnose passing function pointer to `__builtin_assume_aligned` (PR #153552)

2025-08-14 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/153552 >From 63c02556bc65571a84e27debde2e2cfd724a0e9b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Thu, 14 Aug 2025 00:52:37 -0700 Subject: [PATCH 1/2] [clang][Sema] Diagnose passing function pointer to `

[clang] [clang][Sema] Diagnose passing function pointer to `__builtin_assume_aligned` (PR #153552)

2025-08-14 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/153552 The first parameter of the builtin is `const void *`, and function pointers aren't convertible to that. [GCC diagnoses this](https://godbolt.org/z/67njxGE61). >From 63c02556bc65571a84e27debde2e2cfd724a0e9b

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-11 Thread Victor Chernyakin via cfe-commits
@@ -78,6 +79,15 @@ matchEnableIfSpecializationImplTypename(TypeLoc TheType) { if (!TD || TD->getName() != "enable_if") return std::nullopt; +const TemplateParameterList *Params = TD->getTemplateParameters(); +if (Params->size() != 2) + return std::nullop

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-11 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/152938 >From 728fc710260d529a604bf3692b18c9131061e070 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sun, 10 Aug 2025 12:25:26 -0700 Subject: [PATCH 1/4] [clang-tidy] Fix `modernize-use-constraints` crash on

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-10 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/151936 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-10 Thread Victor Chernyakin via cfe-commits
@@ -371,6 +392,21 @@ void UnnecessaryCopyInitialization::diagnoseCopyFromLocalVar( maybeIssueFixes(Ctx, Diagnostic); } +void UnnecessaryCopyInitialization::diagnoseCopyFromConstVarMember( +const CheckContext &Ctx, const VarDecl &OldVar, const MemberExpr &ME) { + std::s

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-10 Thread Victor Chernyakin via cfe-commits
localspook wrote: Latest commit fixes `enable_if_t`, it also causes this crash https://github.com/llvm/llvm-project/pull/152938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-10 Thread Victor Chernyakin via cfe-commits
@@ -78,6 +79,15 @@ matchEnableIfSpecializationImplTypename(TypeLoc TheType) { if (!TD || TD->getName() != "enable_if") return std::nullopt; +const TemplateParameterList *Params = TD->getTemplateParameters(); +if (Params->size() != 2) + return std::nullop

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-10 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/152938 >From 728fc710260d529a604bf3692b18c9131061e070 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sun, 10 Aug 2025 12:25:26 -0700 Subject: [PATCH 1/3] [clang-tidy] Fix `modernize-use-constraints` crash on

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-10 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/152938 >From 728fc710260d529a604bf3692b18c9131061e070 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sun, 10 Aug 2025 12:25:26 -0700 Subject: [PATCH 1/2] [clang-tidy] Fix `modernize-use-constraints` crash on

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-10 Thread Victor Chernyakin via cfe-commits
@@ -78,6 +79,15 @@ matchEnableIfSpecializationImplTypename(TypeLoc TheType) { if (!TD || TD->getName() != "enable_if") return std::nullopt; +const TemplateParameterList *Params = TD->getTemplateParameters(); +if (Params->size() != 2) + return std::nullop

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-10 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/152938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

2025-08-10 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/152938 Fixes #152868. See that issue for details. >From 728fc710260d529a604bf3692b18c9131061e070 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sun, 10 Aug 2025 12:25:26 -0700 Subject: [PATCH] [clang-tidy]

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-08 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/152401 >From f09e05a1aee29d94e908c3ef73d422bad65a3b34 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Wed, 6 Aug 2025 15:31:55 -0700 Subject: [PATCH 1/5] [clang-tidy] Raise minimum standard level for several

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-08 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/152401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-08 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/152401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-08 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/152401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-08 Thread Victor Chernyakin via cfe-commits
localspook wrote: `-fno-delayed-template-parsing` did the trick for some tests! And it was a good hint that helped me figure out why the others were inconsistent: `-fms-extensions` apparently enables C++98-style int-to-pointer conversions in higher language versions, which affects the generate

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-08 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/152401 >From f09e05a1aee29d94e908c3ef73d422bad65a3b34 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Wed, 6 Aug 2025 15:31:55 -0700 Subject: [PATCH 1/4] [clang-tidy] Raise minimum standard level for several

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-07 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/151936 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-07 Thread Victor Chernyakin via cfe-commits
@@ -371,6 +392,21 @@ void UnnecessaryCopyInitialization::diagnoseCopyFromLocalVar( maybeIssueFixes(Ctx, Diagnostic); } +void UnnecessaryCopyInitialization::diagnoseCopyFromConstVarMember( +const CheckContext &Ctx, const VarDecl &OldVar, const MemberExpr &ME) { + std::s

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-07 Thread Victor Chernyakin via cfe-commits
@@ -938,3 +938,59 @@ template bool OperatorWithNoDirectCallee(T t) { ExpensiveToCopyType a2 = a1; return a1 == t; } + +bool CopiedFromParmVarField(const Struct &crs, const Struct cs, Struct &rs, Struct s) { + const auto m1 = crs.Member; + // CHECK-MESSAGES: [[@LINE-1]]:1

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-07 Thread Victor Chernyakin via cfe-commits
localspook wrote: All my comments above this message are resolved, but it seems I can't *mark* them resolved (because I don't have commit permissions, I think?). Could someone else resolve them for me? https://github.com/llvm/llvm-project/pull/151936 ___

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-06 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/152401 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-06 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/152401 >From f09e05a1aee29d94e908c3ef73d422bad65a3b34 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Wed, 6 Aug 2025 15:31:55 -0700 Subject: [PATCH 1/3] [clang-tidy] Raise minimum standard level for several

[clang-tools-extra] [clang-tidy] Raise minimum standard level for several checks from C++98 to C++11 (PR #152401)

2025-08-06 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/152401 `modernize-replace-auto-ptr`, `modernize-use-equals-delete`, and `modernize-use-auto` use `std::unique_ptr`, `= delete`, and `auto` respectively, which are all C++11 features. The interesting bit is `modern

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-05 Thread Victor Chernyakin via cfe-commits
@@ -369,6 +387,18 @@ void UnnecessaryCopyInitialization::diagnoseCopyFromLocalVar( maybeIssueFixes(Ctx, Diagnostic); } +void UnnecessaryCopyInitialization::diagnoseCopyFromConstLocalVarMember( +const CheckContext &Ctx, const VarDecl &OldVar) { + auto Diagnostic = +

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-05 Thread Victor Chernyakin via cfe-commits
@@ -170,6 +170,11 @@ Changes in existing checks when the format string is converted to a different type by an implicit constructor call. +- Improved :doc:`performance-unnecessary-copy-initialization + ` check by + adding detection for the local variables initialized wit

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Enhance the check for the scenario with MemberExpr initialization. (PR #151936)

2025-08-05 Thread Victor Chernyakin via cfe-commits
@@ -939,3 +939,28 @@ template bool OperatorWithNoDirectCallee(T t) { return a1 == t; } +bool CopiedFromConstRefParmVar(const Struct &crs, const Struct cs, Struct &rs, Struct s) { + const auto m1 = crs.Member; + // CHECK-MESSAGES: [[@LINE-1]]:14: warning: local copy 'm1' o

[clang-tools-extra] [clang-tidy][NFC] Enable `readability-avoid-return-with-void-value` check in the codebase (PR #151356)

2025-07-31 Thread Victor Chernyakin via cfe-commits
@@ -610,9 +619,10 @@ void NarrowingConversionsCheck::handleBinaryOperator(const ASTContext &Context, void NarrowingConversionsCheck::check(const MatchFinder::MatchResult &Result) { if (const auto *Op = Result.Nodes.getNodeAs("binary_op")) -return handleBinaryOperator(*R

[clang-tools-extra] [clang-tidy][NFC] Enable `readability-avoid-return-with-void-value` check in the codebase (PR #151356)

2025-07-31 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/151356 >From 8dd39dd51cb3d199734defcb1c0626d608806812 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Wed, 30 Jul 2025 08:38:42 -0700 Subject: [PATCH 1/3] [clang-tidy][NFC] Enable `readability-avoid-return-w

[clang-tools-extra] [clang-tidy][NFC] Enable `readability-avoid-return-with-void-value` check in the codebase (PR #151356)

2025-07-31 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/151356 >From 8dd39dd51cb3d199734defcb1c0626d608806812 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Wed, 30 Jul 2025 08:38:42 -0700 Subject: [PATCH 1/2] [clang-tidy][NFC] Enable `readability-avoid-return-w

[clang-tools-extra] Add clang tidy check performance constexpr non static in scope (PR #147809)

2025-07-30 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/147809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][NFC] Enable `readability-avoid-return-with-void-value` check in the codebase (PR #151356)

2025-07-30 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/151356 None >From 8dd39dd51cb3d199734defcb1c0626d608806812 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Wed, 30 Jul 2025 08:38:42 -0700 Subject: [PATCH] [clang-tidy][NFC] Enable `readability-avoid-return

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-30 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/149694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer][NFC] Run `modernize-use-using` check over all the code (PR #149934)

2025-07-30 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/149934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][NFC] Run `modernize-use-using` check over all the code (PR #149934)

2025-07-30 Thread Victor Chernyakin via cfe-commits
localspook wrote: > Given that there is pushback, its probably safe to split this up into smaller > chunks and let the owners of the parts decide if they want it or not. I can > say for the StaticAnalyzer and Analysis libraries its a welcomed change. Yep, I've gone and limited the changes in t

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-29 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/149694 >From 823bfd458a0e03125d84fd676fbc284f09b50a5b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 19 Jul 2025 23:43:55 -0700 Subject: [PATCH 1/4] [clang-tidy] Make `modernize-use-using`'s fixits more

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-29 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/149694 >From 823bfd458a0e03125d84fd676fbc284f09b50a5b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 19 Jul 2025 23:43:55 -0700 Subject: [PATCH 1/4] [clang-tidy] Make `modernize-use-using`'s fixits more

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-29 Thread Victor Chernyakin via cfe-commits
localspook wrote: Nope; that's the preexisting issue I mention in the description. I believe fixing it in the general case would require Clang to provide extra information in `TypedefDecl`, something like a `SourceRange DeclSpecSeqRange`: ```cpp typedef const int *ptr1, *ptr2; ^

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-28 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/150791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-28 Thread Victor Chernyakin via cfe-commits
@@ -19,13 +18,16 @@ void notRelated(int A, int B) {} int addedTogether(int A, int B) { return add(A, B); } // NO-WARN: Passed to same function. +// FIXME: This triggers a false positive: the "passed to same function" heuristic +// can't map the parameter index 1 to A and B

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-28 Thread Victor Chernyakin via cfe-commits
@@ -1,6 +1,5 @@ -// RUN: %check_clang_tidy %s readability-magic-numbers %t -- +// RUN: %check_clang_tidy -std=c23-or-later %s readability-magic-numbers %t // Don't crash _BitInt(128) A = 4533629751480627964421wb; -// CHECK-MESSAGES: warning localspook wrote:

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-28 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/150791 >From 20eb165f1abd9bf7976a2c401579a1284258e13e Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 26 Jul 2025 11:52:19 -0700 Subject: [PATCH 1/5] [clang-tidy] Stop ignoring `-std` argument in `check

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-28 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/150791 >From 20eb165f1abd9bf7976a2c401579a1284258e13e Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 26 Jul 2025 11:52:19 -0700 Subject: [PATCH 1/4] [clang-tidy] Stop ignoring `-std` argument in `check

[clang-tools-extra] [clang-tidy] Speed up `misc-header-include-cycle` (PR #148757)

2025-07-27 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/148757 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Add `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/150791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/150791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
@@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s readability-non-const-parameter %t +// RUN: %check_clang_tidy -std=c99,c11,c17 %s readability-non-const-parameter %t localspook wrote: The single test case in this file is a K&R-style function, so I don't think ther

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
@@ -19,13 +18,16 @@ void notRelated(int A, int B) {} int addedTogether(int A, int B) { return add(A, B); } // NO-WARN: Passed to same function. +// FIXME: This triggers a false positive: the "passed to same function" heuristic +// can't map the parameter index 1 to A and B

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
@@ -5,14 +5,14 @@ // parsing and preprocessor state will not have that case. // UNSUPPORTED: target={{.*-(ps4|ps5)}} // -// RUN: %check_clang_tidy -check-suffix=WITH-ANNEX-K%s bugprone-unsafe-functions %t -- -- -D__STDC_LIB_EXT1__=1 -D__STDC_WANT_LIB_EXT1__=1 -//

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
@@ -374,15 +373,25 @@ def parse_arguments() -> Tuple[argparse.Namespace, List[str]]: parser.add_argument( "-std", type=csv, -default=["c++11-or-later"], +default=None, help="Passed to clang. Special -or-later values are expanded.",

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/150791 >From 20eb165f1abd9bf7976a2c401579a1284258e13e Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 26 Jul 2025 11:52:19 -0700 Subject: [PATCH 1/3] [clang-tidy] Stop ignoring `-std` argument in `check

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/150791 >From 20eb165f1abd9bf7976a2c401579a1284258e13e Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 26 Jul 2025 11:52:19 -0700 Subject: [PATCH 1/2] [clang-tidy] Stop ignoring `-std` argument in `check

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/150791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/150791 >From 20eb165f1abd9bf7976a2c401579a1284258e13e Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 26 Jul 2025 11:52:19 -0700 Subject: [PATCH] [clang-tidy] Stop ignoring `-std` argument in `check_cla

[clang-tools-extra] [clang-tidy] Teach `readability-uppercase-literal-suffix` about C++23 and C23 suffixes (PR #148275)

2025-07-26 Thread Victor Chernyakin via cfe-commits
@@ -0,0 +1,162 @@ +// TODO: When Clang adds support for decimal floating point types, enable these tests by: +//1. Removing all the #if 0 + #endif guards. +//2. Removing all occurrences of the string "DISABLED-" in this file. +//3. Deleting this message. + +// RUN: %c

[clang-tools-extra] [clang-tidy] Stop ignoring `-std` argument in `check_clang_tidy.py` for C files (PR #150791)

2025-07-26 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/150791 Before, the tests were run with whatever Clang defaults to when you don't specify a standard. The tests are adapted to account for various things: - `typeof` is changed to `__typeof__`; the non-`__ugly__` s

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-21 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/149694 >From 823bfd458a0e03125d84fd676fbc284f09b50a5b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 19 Jul 2025 23:43:55 -0700 Subject: [PATCH 1/4] [clang-tidy] Make `modernize-use-using`'s fixits more

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-21 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/149694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-21 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/149694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-21 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/149694 >From 823bfd458a0e03125d84fd676fbc284f09b50a5b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 19 Jul 2025 23:43:55 -0700 Subject: [PATCH 1/3] [clang-tidy] Make `modernize-use-using`'s fixits more

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook ready_for_review https://github.com/llvm/llvm-project/pull/149694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/149694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fix-its more robust (PR #149694)

2025-07-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook edited https://github.com/llvm/llvm-project/pull/149694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fixits more robust (PR #149694)

2025-07-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/149694 >From 823bfd458a0e03125d84fd676fbc284f09b50a5b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 19 Jul 2025 23:43:55 -0700 Subject: [PATCH 1/2] [clang-tidy] Make `modernize-use-using`'s fixits more

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fixits more robust (PR #149694)

2025-07-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook converted_to_draft https://github.com/llvm/llvm-project/pull/149694 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fixits more robust (PR #149694)

2025-07-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/149694 >From 823bfd458a0e03125d84fd676fbc284f09b50a5b Mon Sep 17 00:00:00 2001 From: Victor Chernyakin Date: Sat, 19 Jul 2025 23:43:55 -0700 Subject: [PATCH] [clang-tidy] Make `modernize-use-using`'s fixits more rob

[clang-tools-extra] [clang-tidy] Make `modernize-use-using`'s fixits more robust (PR #149694)

2025-07-20 Thread Victor Chernyakin via cfe-commits
https://github.com/localspook created https://github.com/llvm/llvm-project/pull/149694 Fixes #105503. Fixes #31141 (the new fixit is not the one the author suggests, but now it's at least *correct*). First, let's look at `typedef`s that only introduce one name. Currently, this fails in severa

  1   2   >