[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2025-01-13 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/120055 ___ 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 readability-string-view-substr check (PR #120055)

2025-01-13 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,217 @@ +//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ -*-===// +// +// 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] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2025-01-13 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: You can move even more into the matchers. Here is a mock-up of what I mean (untested): ``` m cxxMemberCallExpr( anyOf( cxxMemberCallExpr( argumentCountIs(1) # is substr, and bind arg 1 ), cxxMemberCallExpr( argumentCoun

[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2025-01-13 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,217 @@ +//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ -*-===// +// +// 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] [clang-tidy][use-internal-linkage] fix false positive for consteval function (PR #122141)

2025-01-10 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/122141 ___ 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] optimize cache for config option (PR #121406)

2025-01-09 Thread Julian Schmidt via cfe-commits
@@ -337,33 +337,34 @@ FileOptionsBaseProvider::FileOptionsBaseProvider( void FileOptionsBaseProvider::addRawFileOptions( llvm::StringRef AbsolutePath, std::vector &CurOptions) { auto CurSize = CurOptions.size(); - // Look for a suitable configuration file in all parent

[clang-tools-extra] [clang-tidy][NFC] optimize cache for config option (PR #121406)

2025-01-09 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/121406 ___ 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] optimize cache for config option (PR #121406)

2025-01-09 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/121406 ___ 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 C++ member function support to custom bugprone-unsafe-functions matches (PR #117165)

2025-01-09 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/117165 ___ 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 C++ member function support to custom bugprone-unsafe-functions matches (PR #117165)

2025-01-09 Thread Julian Schmidt via cfe-commits
@@ -139,6 +150,12 @@ Options function, and an optional reason, separated by comma. For more information, see :ref:`Custom functions`. +.. option:: ShowFullyQualifiedNames + +When `true`, the fully qualified name of all functions matched by the custom +function

[clang-tools-extra] [clang-tidy] fix false positives when using name-independent variables after C++26 for bugprone-unused-local-non-trivial-variable (PR #121783)

2025-01-08 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/121783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2025-01-07 Thread Julian Schmidt via cfe-commits
@@ -40,11 +40,30 @@ void UncheckedOptionalAccessCheck::registerMatchers(MatchFinder *Finder) { this); } +void UncheckedOptionalAccessCheck::onStartOfTranslationUnit() { + // Reset the flag for each TU. + is_test_tu_ = false; +} + void UncheckedOptionalAccessCheck::ch

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2025-01-07 Thread Julian Schmidt via cfe-commits
@@ -40,11 +40,30 @@ void UncheckedOptionalAccessCheck::registerMatchers(MatchFinder *Finder) { this); } +void UncheckedOptionalAccessCheck::onStartOfTranslationUnit() { + // Reset the flag for each TU. + is_test_tu_ = false; +} + void UncheckedOptionalAccessCheck::ch

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2025-01-07 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Sorry for the delay. I think, that we can probably all agree that the best solution would be to have the model support the macros, e.g., by recognizing the patterns that are behind these macros. However, that is currently not something that people can fin

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2025-01-07 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/115051 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][doc] mention smart ptr in bugprone-unhandled-self-assignment.WarnOnlyIfThisHasSuspiciousField option (PR #121316)

2024-12-30 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/121316 ___ 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 bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,134 @@ +//===--- SmartptrResetAmbiguousCallCheck.cpp - clang-tidy -===// +// +// 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] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,34 @@ +.. title:: clang-tidy - bugprone-smartptr-reset-ambiguous-call + +bugprone-smartptr-reset-ambiguous-call +== + +Finds potentially erroneous calls to ``reset`` method on +smart pointers when the pointee type also has a ``reset``

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,34 @@ +//===--- SmartptrResetAmbiguousCallCheck.h - clang-tidy -*- C++ -*-===// +// +// 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] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
@@ -144,6 +145,8 @@ class BugproneModule : public ClangTidyModule { "bugprone-inaccurate-erase"); CheckFactories.registerCheck( "bugprone-incorrect-enable-if"); +CheckFactories.registerCheck( +"bugprone-smartptr-reset-ambiguous-call"); --

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,34 @@ +.. title:: clang-tidy - bugprone-smartptr-reset-ambiguous-call + +bugprone-smartptr-reset-ambiguous-call +== + +Finds potentially erroneous calls to ``reset`` method on +smart pointers when the pointee type also has a ``reset``

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,34 @@ +.. title:: clang-tidy - bugprone-smartptr-reset-ambiguous-call + +bugprone-smartptr-reset-ambiguous-call +== + +Finds potentially erroneous calls to ``reset`` method on +smart pointers when the pointee type also has a ``reset``

[clang-tools-extra] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/121291 ___ 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 bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,134 @@ +//===--- SmartptrResetAmbiguousCallCheck.cpp - clang-tidy -===// +// +// 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] [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (PR #121291)

2024-12-30 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti requested changes to this pull request. I think that this check is one that we don't want to emit fixes for, at least not in the main diagnostic, but maybe as a fixit attached to a note. Sort of like: ``` warning: ... note: (be more explicit and) use '= nullptr' ```

[clang-tools-extra] [clang-tidy] add depercation warning for non-whitelisted global options (PR #121057)

2024-12-30 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Looks good from my side. --- > Perhaps we can just land this as is for now and introduce the escape hatch if > we get feedback indicating it's needed? I think that is totally fine. If this comes up, we can also immediately backport the

[clang-tools-extra] [clang-tidy] Mention std::forward_list in container-size-empty doc (PR #120701)

2024-12-28 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/120701 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][ASTMatcher] Add `dependentNameType` Matcher (PR #121263)

2024-12-28 Thread Julian Schmidt via cfe-commits
@@ -7711,6 +7711,16 @@ AST_MATCHER_P(DecayedType, hasDecayedType, internal::Matcher, return InnerType.matches(Node.getDecayedType(), Finder, Builder); } +/// Matches dependent name type 5chmidti wrote: nit: `a dependent name type` (+1 in release notes) ht

[clang] [Clang][ASTMatcher] Add `dependentNameType` Matcher (PR #121263)

2024-12-28 Thread Julian Schmidt via cfe-commits
@@ -218,6 +218,7 @@ RegistryMaps::RegistryMaps() { REGISTER_MATCHER(cxxTryStmt); REGISTER_MATCHER(cxxUnresolvedConstructExpr); REGISTER_MATCHER(decayedType); + REGISTER_MATCHER(dependentNameType); 5chmidti wrote: Please sort this in alphabetically http

[clang-tools-extra] [clang-tidy] add depercation warning for non-whitelisted global options (PR #121057)

2024-12-28 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > Good point, maybe we can use more smart way to do warning: only warn the > global option is set but local option is not. > > Have some redundant options is not the aim for this deprecation things, we > only want to avoid user suddenly find the behaviors of lots of check are

[clang-tools-extra] [clang-tidy] swap cppcoreguidelines-narrowing-conversions and bugprone-narrowing-conversions (PR #120245)

2024-12-28 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/120245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2024-12-28 Thread Julian Schmidt via cfe-commits
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) { static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, ArrayRef Indexes, const ASTContext &Ctx) { + auto GetC

[clang-tools-extra] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-23 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > but now templates seem to be skipped completely Template instantiations are skipped, not their definition. The matchers no longer work, because the types you are working with are no longer necessarily concrete types, but instead they can be dependent. And so can be expression

[clang-tools-extra] [clang-tidy] use specified type verbatim in modernize-use-using fix (PR #113837)

2024-12-21 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti closed https://github.com/llvm/llvm-project/pull/113837 ___ 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] extract options verify to separately function (PR #120768)

2024-12-20 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/120768 ___ 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 readability-use-span-first-last check (PR #118074)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: You could try to implement the check with `TK_TraverseUnlessSpelledInSource` if you'd like, which would only add two more matchers via `addMatcher`, and the traversal kind function (https://godbolt.org/z/GrfMTxeGa). IMO, this can be done in a follow-up by

[clang-tools-extra] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,97 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] Add readability-use-span-first-last check (PR #118074)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/118074 ___ 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 readability-use-span-first-last check (PR #118074)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,97 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] support parameters file in command line (PR #120547)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: As this is not using `llvm::cl`, it is not automatically documented in `--help`. Maybe some sort of comment inside `ClangTidyHelp` would help with the discoverability from the CLI. https://github.com/llvm/llvm-project/pull/120547 _

[clang-tools-extra] [clang-tidy] support parameters file in command line (PR #120547)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/120547 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] support parameters file in command line (PR #120547)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -33,6 +33,13 @@ compilation options on the command line after ``--``: $ clang-tidy test.cpp -- -Imy_project/include -DMY_DEFINES ... +If there are too many options to specify on the command line, you can store them +in a parameter file, and use :program:`clang-tidy` wit

[clang-tools-extra] [analyzer] Split alpha core Identical Expression tests (PR #119543)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Thanks. LGTM from my side, but give it a few days in case the others want to review as well https://github.com/llvm/llvm-project/pull/119543 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang-tools-extra] [clang-tidy][NFC] swap cppcoreguidelines-narrowing-conversions and bugprone-narrowing-conversions (PR #120245)

2024-12-19 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Please change the header guard to use `bugprone` as the 'path' instead of `cppcoreguidelines` https://github.com/llvm/llvm-project/pull/120245 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang-tools-extra] [clang-tidy][NFC] swap cppcoreguidelines-narrowing-conversions and bugprone-narrowing-conversions (PR #120245)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -1,10 +1,93 @@ .. title:: clang-tidy - bugprone-narrowing-conversions -.. meta:: - :http-equiv=refresh: 5;URL=../cppcoreguidelines/narrowing-conversions.html bugprone-narrowing-conversions == -The bugprone-narrowing-conversions check is an a

[clang-tools-extra] [clang-tidy][NFC] swap cppcoreguidelines-narrowing-conversions and bugprone-narrowing-conversions (PR #120245)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -411,7 +411,7 @@ Check aliases .. csv-table:: :header: "Name", "Redirect", "Offers fixes" - :doc:`bugprone-narrowing-conversions `, :doc:`cppcoreguidelines-narrowing-conversions `, + :doc:`cppcoreguidelines-narrowing-conversions `, :doc:`bugprone-narrowing-convers

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-19 Thread Julian Schmidt via cfe-commits
5chmidti wrote: You have added `-check-suffix` options to each of your `RUN` lines, but none of your `CHECK-MESSAGES` are actually using it. E.g.,: ```C++ // CHECK-MESSAGES-TO-BOOL-FALSE ``` Although, instead of using the suffixes to say `FALSE`, you could sw

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -287,72 +292,83 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) { auto BoolXor = binaryOperator(hasOperatorName("^"), hasLHS(ImplicitCastFromBool), hasRHS(ImplicitCastFromBool)); - auto ComparisonInCall = allOf( -

[clang-tools-extra] Added options to readability-implicit-bool-conversion (PR #120087)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -319,10 +319,9 @@ Changes in existing checks diagnostic. - Improved :doc:`readability-implicit-bool-conversion - ` check - by adding the option `UseUpperCaseLiteralSuffix` to select the - case of the literal suffix in fixes and fixing false positive for implicit - con

[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,39 @@ +//===--- StringViewSubstrCheck.h - clang-tidy-*- C++ +//-*-===// +// +// 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:

[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,39 @@ +//===--- StringViewSubstrCheck.h - clang-tidy-*- C++ +//-*-===// +// +// 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:

[clang-tools-extra] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,201 @@ +//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ -*-===// +// +// 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] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,201 @@ +//===--- StringViewSubstrCheck.cpp - clang-tidy--*- C++ -*-===// +// +// 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] [clang-tidy] Add readability-string-view-substr check (PR #120055)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/120055 ___ 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 readability-string-view-substr check (PR #120055)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: The detected issues together with the fixes can currently produce code that can't compile. For example: ```diff void f(std::string_view sv); void g(std::string_view sv) { - const auto copy = sv = sv.substr(0, sv.length() - 3);

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Consider static functions (PR #119974)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/119974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [analyzer] Split alpha core Identical Expression tests (PR #119543)

2024-12-19 Thread Julian Schmidt via cfe-commits
5chmidti wrote: The file-names should follow the naming convention of the other tests: `checkers/misc/redundant-expression.cpp` (applies to both). @HerrCai0907 @PiotrZSL IMO merging these tests with the existing ones would result in too-large files, so the files would probably be named somet

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -28,6 +28,7 @@ #include "llvm/ADT/Twine.h" #include "llvm/Support/raw_ostream.h" #include +#include 5chmidti wrote: Please remove this include https://github.com/llvm/llvm-project/pull/118568 ___ cfe-commits ma

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/118568 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2024-12-19 Thread Julian Schmidt via cfe-commits
@@ -173,21 +174,21 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, for (unsigned Index : Sorted) { const Expr *Arg = Call.getArg(Index); if (Commas[Index]) { - if (Index >= Commas.size()) { -Diag << FixItHint::CreateRemov

[clang-tools-extra] [clang-tidy][clangd] Fixed removeFunctionArgs don't remove comma for use-ranges check (PR #118568)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: No release note is fine for this patch, as this fixes a problem that is invisible when using clang-tidy, but visible with clangd. The general case for clangd is fixed in #118569. Otherwise, I don't think this would be a release note for clang-tidy, but fo

[clang-tools-extra] [clang-tidy][docs] improve documentation on cppcoreguidelines-narrowing-conversions (#111510) (PR #118209)

2024-12-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/118209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ASTMatchers] fix `isStaticStorageClass` not matching definitions of forward declared functions (PR #120027)

2024-12-16 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Another solution would be to explicitly document the definition is not matching with `isStaticStorageClass`, and we add `hasCanonicalDecl`. That solution would do less behind the scenes at the cost of potentially tripping poeple up (though documenting this for `isStaticStorageC

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Consider static functions (PR #119974)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/119974 ___ 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: Consider static functions (PR #119974)

2024-12-15 Thread Julian Schmidt via cfe-commits
@@ -104,14 +104,16 @@ AST_MATCHER_FUNCTION_P(StatementMatcher, hasArgument(0, hasType(ReceiverType); } +AST_MATCHER(CXXMethodDecl, isStatic) { return Node.isStatic(); } + AST_MATCHER_FUNCTION(StatementMatcher, isConstRefReturningFunctionCal

[clang-tools-extra] [clang-tidy] performance-unnecessary-copy-initialization: Consider static functions (PR #119974)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/119974 ___ 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: Consider static functions (PR #119974)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: > Not sure how many more tests I should add, since this uses the same code > paths as free functions. I think the amount of tests you've added are enough > This is the 5th instance of the `isStatic` matcher in clang-tidy. Good point, thanks. I've checked

[clang] [ASTMatchers] fix `isStaticStorageClass` not matching definitions of forward declared functions (PR #120027)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti ready_for_review https://github.com/llvm/llvm-project/pull/120027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ASTMatchers] fix `isStaticStorageClass` not matching definitions of forward declared functions (PR #120027)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/120027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ASTMatchers] fix `isStaticStorageClass` not matching definitions of forward declared functions (PR #120027)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/120027 >From 07dd31ddd40cdb792d33fc3394f6356de029a137 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Mon, 16 Dec 2024 01:28:42 +0100 Subject: [PATCH] [ASTMatchers] fix `isStaticStorageClass` not matching definit

[clang] [clang-tools-extra] [ASTMatchers] fix `isStaticStorageClass` not matching definitions of forward declared functions (PR #120027)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/120027 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [ASTMatchers] fix `isStaticStorageClass` not matching definitions of forward declared functions (PR #120027)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/120027 >From 35a1cecb08d1827fb45c2e6bb06983ed363ca769 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Mon, 16 Dec 2024 01:18:06 +0100 Subject: [PATCH] [ASTMatchers] fix `isStaticStorageClass` not matching definit

[clang] [clang-tools-extra] [ASTMatchers] fix `isStaticStorageClass` not matching definitions of forward declared functions (PR #120027)

2024-12-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/120027 ```c++ static void foo(); void foo() {} struct A { static void bar(); }; void A::bar() {} ``` Both definitions refer to their previous declaration, but were not considered `static`, because the matcher did

[clang-tools-extra] [clang-tidy] fix cppcoreguidelines-narrowing-conversions false positives when narrowing integer to signed integer in C++20 (PR #116591)

2024-12-15 Thread Julian Schmidt via cfe-commits
5chmidti wrote: The move to bugprone makes sense to me. However, I'm not sure that conversions of integers to signed integers should be ignored-by-default since C++20. It may be well-defined behavior w.r.t. the resulting value, but the pattern is still prone to bugs. You will get a well-defi

[clang-tools-extra] [clang-tidy] use specified type verbatim in modernize-use-using fix (PR #113837)

2024-12-15 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Ping https://github.com/llvm/llvm-project/pull/113837 ___ 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] use local config in test cases (PR #120004)

2024-12-15 Thread Julian Schmidt via cfe-commits
@@ -26,7 +26,7 @@ class InconsistentDeclarationParameterNameCheck : public ClangTidyCheck { ClangTidyContext *Context) : ClangTidyCheck(Name, Context), IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)), -

[clang-tools-extra] [clang-tidy] remove misuse of `getLocalOrGlobal` for non common used options (PR #119948)

2024-12-14 Thread Julian Schmidt via cfe-commits
5chmidti wrote: @HerrCai0907 Could you retroactively add a release note? While this hopefully doesn't exist in anyone's config, but if someone were to look, they'd see why this was done. https://github.com/llvm/llvm-project/pull/119948 ___ cfe-commi

[clang-tools-extra] [clang-tidy] remove misuse of `getLocalOrGlobal` for non common used options (PR #119948)

2024-12-14 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Thanks https://github.com/llvm/llvm-project/pull/119948 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [analyzer] Split alpha core Identical Expression tests (PR #119543)

2024-12-12 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/119543 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Permit noescape on non-pointer types (PR #117344)

2024-12-12 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > whether `bugprone-no-escape` would want to see these changes or not. The `bugprone-no-escape` check seems to be a bit limited because it only works with `dispatch_async` and `dispatch_after` (from Apple, it seems). It could probably be expanded to include some more async cons

[clang-tools-extra] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,104 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,104 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,104 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/118074 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [analyzer] Split alpha core Identical Expression tests (PR #119543)

2024-12-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/119543 ___ 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][doc] clean out-dated clang-static-analyzer checks (PR #119580)

2024-12-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/119580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [analyzer] Split alpha core Identical Expression tests (PR #119543)

2024-12-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Please change the `RUN` lines to use `check_clang_tidy` like so: `// RUN: %check_clang_tidy %s bugprone-branch-clone %t`, and drop the `BUGPRONEBRANCH` suffix in `bugprone-branch-clone.cpp`, as it is redundant after this change, and after removing the acci

[clang-tools-extra] [analyzer] Split alpha core Identical Expression tests (PR #119543)

2024-12-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,772 @@ +// RUN: clang-tidy %s -checks="-*,bugprone-branch-clone" -- 2>&1 | FileCheck %s --check-prefix=CHECK-MESSAGES-BUGPRONEBRANCH + +/* Only one expected warning per function allowed at the very end. */ + +int func(void) +{ + return 0; +} + +int func2(void) +{ + r

[clang-tools-extra] [clang-tidy]detecting conversion directly by `make_unique` and `make_shared` in bugprone-optional-value-conversion (PR #119371)

2024-12-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/119371 ___ 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 readability-use-span-first-last check (PR #118074)

2024-12-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,96 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-06 Thread Julian Schmidt via cfe-commits
@@ -27,19 +29,44 @@ class UncheckedOptionalAccessCheck : public ClangTidyCheck { UncheckedOptionalAccessCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), ModelOptions{ -Options.getLocalOrGlobal("IgnoreSmartPointerDeref

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-06 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/115051 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-06 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/115051 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-06 Thread Julian Schmidt via cfe-commits
@@ -27,19 +29,44 @@ class UncheckedOptionalAccessCheck : public ClangTidyCheck { UncheckedOptionalAccessCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), ModelOptions{ -Options.getLocalOrGlobal("IgnoreSmartPointerDeref

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-06 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Please also add an `ASSERT_FALSE` (or just `ASSERT_TRUE(!opt.has_value())`) with a dereference after, to show that there are false-negatives https://github.com/llvm/llvm-project/pull/115051 ___ cfe-co

[clang-tools-extra] [clang-tidy] Filter out googletest TUs in bugprone-unchecked-optional-access (PR #115051)

2024-12-06 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: > option that is off by default. For all other users the behavior is unchanged, > but we can opt in on our side. > Can we add the option to use in the meantime, while I work on the macro > handling in parallel? That sounds okay to me, even though the opti

[clang-tools-extra] [clang-tidy] Add readability-use-span-first-last check (PR #118074)

2024-12-06 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,96 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] Add readability-use-span-first-last check (PR #118074)

2024-12-06 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,96 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] Add readability-use-span-first-last check (PR #118074)

2024-12-06 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,96 @@ +//===--- UseSpanFirstLastCheck.cpp - clang-tidy -*- C++ -*-===// +// +// 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] Add readability-use-span-first-last check (PR #118074)

2024-12-06 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: > wasting effort would not be the problem (it never is; learning is the goal) - > right now i just dont understand the difference, and therefore dont see the > benefit, as far as i see it would introduce more complicated code to still > handle templates.

  1   2   3   4   5   6   7   8   9   10   >