[clang-tools-extra] [clang-tidy] Create bugprone-bit-cast-pointers check (PR #108083)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,34 @@ +// RUN: %check_clang_tidy -std=c++20-or-later %s bugprone-bit-cast-pointers %t + +namespace std +{ +template +To bit_cast(From from) +{ + // Dummy implementation for the purpose of the test. + // We don't want to include to get std::memcpy. + To to{}; + ret

[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -10,6 +10,9 @@ modernize-avoid-c-arrays Finds C-style array types and recommend to use ``std::array<>`` / ``std::vector<>``. All types of C arrays are diagnosed. +For incomplete C-style array types appeared in parameters, It would be better to +use ``std::span`` / ``gsl::s

[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -72,11 +74,29 @@ void AvoidCArraysCheck::registerMatchers(MatchFinder *Finder) { void AvoidCArraysCheck::check(const MatchFinder::MatchResult &Result) { const auto *ArrayType = Result.Nodes.getNodeAs("typeloc"); - + const bool IsInParam = + Result.Nodes.getNodeAs("

[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -112,8 +112,9 @@ Changes in existing checks the offending code with ``reinterpret_cast``, to more clearly express intent. - Improved :doc:`modernize-avoid-c-arrays - ` check to suggest use std::span - as replacement of c array in C++20. + ` check to suggest using + `

[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

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

[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

2024-09-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM, just small nits. But wait for others to approve as well https://github.com/llvm/llvm-project/pull/108555 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -72,11 +74,29 @@ void AvoidCArraysCheck::registerMatchers(MatchFinder *Finder) { void AvoidCArraysCheck::check(const MatchFinder::MatchResult &Result) { const auto *ArrayType = Result.Nodes.getNodeAs("typeloc"); - + const bool IsInParam = + Result.Nodes.getNodeAs("

[clang-tools-extra] [clang-tidy]suggest use `std::span` as replacement of c array in C++20 for modernize-avoid-c-arrays (PR #108555)

2024-09-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/108555 ___ 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 false positive that floating point variable only used in increment expr in cert-flp30-c (PR #108706)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -9,22 +9,33 @@ #include "FloatLoopCounter.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" using namespace clang::ast_matchers; namespace clang::tidy::cert { void FloatLoopCounter::registe

[clang-tools-extra] [clang-tidy] fix false positive that floating point variable only used in increment expr in cert-flp30-c (PR #108706)

2024-09-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/108706 ___ 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 false positive that floating point variable only used in increment expr in cert-flp30-c (PR #108706)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -111,6 +111,9 @@ Changes in existing checks ` check to suggest replacing the offending code with ``reinterpret_cast``, to more clearly express intent. +- Improved :doc:`cert-flp30-c` check to + fix false positive that floating point variable only used in increment exp

[clang-tools-extra] [clang-tidy] fix false positive when member initialization depends on structured binging variable in cppcoreguidelines-prefer-member-initializer (PR #108743)

2024-09-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/108743 ___ 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 false positive when member initialization depends on structured binging variable in cppcoreguidelines-prefer-member-initializer (PR #108743)

2024-09-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/108743 ___ 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 false positive when member initialization depends on structured binging variable in cppcoreguidelines-prefer-member-initializer (PR #108743)

2024-09-15 Thread Julian Schmidt via cfe-commits
@@ -111,6 +111,10 @@ Changes in existing checks ` check to suggest replacing the offending code with ``reinterpret_cast``, to more clearly express intent. +- Improved :doc:`cppcoreguidelines-prefer-member-initializer + ` check to avoid + false positive when member initi

[clang-tools-extra] [clang-tidy] only diagnose definitions in readability-enum-initial-value (PR #107652)

2024-09-16 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/107652 >From 991b6a70b81a9bdef6edf931d26e9430c56bf0ca Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 7 Sep 2024 00:37:57 +0200 Subject: [PATCH 1/3] [clang-tidy] only diagnose definitions in readability-enum

[clang-tools-extra] [clang-tidy] fix false positive in modernize-min-max-use-initializer-list (PR #107649)

2024-09-16 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/107649 >From 097a679f33bdded29fa67833b7fcd4707057cbf3 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 7 Sep 2024 00:10:08 +0200 Subject: [PATCH 1/3] [clang-tidy] fix false positive in modernize-min-max-use-i

[clang-tools-extra] [clang-tidy] fix false positive in modernize-min-max-use-initializer-list (PR #107649)

2024-09-16 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/107649 >From 097a679f33bdded29fa67833b7fcd4707057cbf3 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 7 Sep 2024 00:10:08 +0200 Subject: [PATCH 1/4] [clang-tidy] fix false positive in modernize-min-max-use-i

[clang-tools-extra] [clang-tidy] fix false positive in modernize-min-max-use-initializer-list (PR #107649)

2024-09-16 Thread Julian Schmidt via cfe-commits
@@ -72,7 +72,7 @@ static FindArgsResult findArgs(const CallExpr *Call) { return Result; } -static SmallVector +static std::pair> 5chmidti wrote: done https://github.com/llvm/llvm-project/pull/107649 ___ cfe-commi

[clang-tools-extra] [NFC][clang-tidy] reword diagnostic note in definitions-in-headers (PR #106862)

2024-09-16 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/106862 >From c641dd2a2cb6185b088e469a5f5db160e8c76bae Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 31 Aug 2024 18:44:37 +0200 Subject: [PATCH 1/3] [NFC][clang-tidy] reword diagnostic note in definitions-i

[clang-tools-extra] [clang-tidy] fix nullptr dereference in bugprone-forwarding-reference (PR #106856)

2024-09-16 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/106856 >From f47b807598ed0e80d3e3bd2c05699f977a2395bf Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 31 Aug 2024 16:56:54 +0200 Subject: [PATCH] [clang-tidy] fix nullptr dereference in bugprone-forwarding-r

[clang-tools-extra] [clang-tidy] fix nullptr dereference in bugprone-forwarding-reference (PR #106856)

2024-09-16 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/106856 >From f47b807598ed0e80d3e3bd2c05699f977a2395bf Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 31 Aug 2024 16:56:54 +0200 Subject: [PATCH 1/2] [clang-tidy] fix nullptr dereference in bugprone-forwardi

[clang-tools-extra] [clang-tidy] fix nullptr dereference in bugprone-forwarding-reference (PR #106856)

2024-09-16 Thread Julian Schmidt via cfe-commits
@@ -119,7 +123,6 @@ Changes in existing checks ` check to avoid false positive when member initialization depends on a structured binging variable. - 5chmidti wrote: thanks https://github.com/llvm/llvm-project/pull/106856 __

[clang-tools-extra] [clang-tidy][performance-move-const-arg] Fix crash when argument type has no definition (PR #111472)

2024-10-08 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Please add a release note, otherwise LGTM https://github.com/llvm/llvm-project/pull/111472 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang-tools-extra] [clang-tidy] Only expand macros in modernize-use-std-format/print (PR #97911)

2024-10-08 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Yep, thanks. Sorry for the delay https://github.com/llvm/llvm-project/pull/97911 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Only expand macros in modernize-use-std-format/print (PR #97911)

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

[clang] [clang-tools-extra] [clang-tidy] bugprone-implicit-widening ignores unsigned consts (PR #101073)

2024-10-08 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Looking at the clang-tidy changes only, this looks good. Though, I don't know if the changes to Clang are okay with Clang maintainers, but maybe they have an untapped use for this as well? Either way, a Clang maintainer needs to sign off on those changes before merging. Maybe t

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -86,6 +88,15 @@ AST_MATCHER(VarDecl, hasIdentifier) { } // namespace +MissingStdForwardCheck::MissingStdForwardCheck(StringRef Name, + ClangTidyContext *Context) +: ClangTidyCheck(Name, Context), + IgnoreStaticCasts(Op

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-10-13 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Sorry for the delay. Feel free to ping PRs that had no activity https://github.com/llvm/llvm-project/pull/99477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listin

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

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

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -38,3 +38,12 @@ Example: This check implements `F.19 `_ from the C++ Core Guidelines. + +Options +--- + +.. option:: IgnoreStaticCasts + + Boolean flag to allow users who want to use the forwarding

[clang-tools-extra] [clang-tidy] Make `P +- BS / sizeof(*P)` opt-outable in `bugprone-sizeof-expression` (PR #111178)

2024-10-12 Thread Julian Schmidt via cfe-commits
@@ -352,21 +352,30 @@ void good13(void) { int Buffer[BufferSize]; int *P = &Buffer[0]; - while (P < (Buffer + sizeof(Buffer) / sizeof(int))) { + while (P < Buffer + sizeof(Buffer) / sizeof(int)) { // NO-WARNING: Calculating the element count of the buffer here, whic

[clang-tools-extra] [clang-tidy] Make `P +- BS / sizeof(*P)` opt-outable in `bugprone-sizeof-expression` (PR #111178)

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

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,92 @@ +//===--- IncorrectEnableSharedFromThisCheck.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: Apa

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,92 @@ +//===--- IncorrectEnableSharedFromThisCheck.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: Apa

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -98,6 +98,13 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`bugprone-incorrect-enable-shared-from-this + ` check. + + Detects if class/structs publicly inherits from ``std::enable_shared_from_this``, 5chmidti wrote: `Detects if a class

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

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

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,35 @@ +//===--- IncorrectEnableSharedFromThisCheck.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] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2024-10-13 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: This is 'basically' ready. Sorry for the delay. --- As stated in the comment, I've benchmarked the RAV and matcher-based solution, and they perform the same. So the actual (performance) benefit of using the RAV does not actually exist. I'd suggest using

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,34 @@ +.. title:: clang-tidy - bugprone-incorrect-enable-shared-from-this + +bugprone-incorrect-enable-shared-from-this +== + +Detects if a class or struct publicly inherits from +``std::enable_shared_from_this``, because uninten

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-13 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/112101 >From cd6de859501e8c0102aa1c1e57341ecc35266ed1 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 12 Oct 2024 18:07:38 +0200 Subject: [PATCH 1/3] [clang-tidy] rewrite matchers in modernize-use-starts-end

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -82,34 +84,25 @@ UseStartsEndsWithCheck::UseStartsEndsWithCheck(StringRef Name, void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) { const auto ZeroLiteral = integerLiteral(equals(0)); - const auto HasStartsWithMethodWithName = [](const std::string &Name

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-13 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Whoops, I had forgotten to send my replies :) https://github.com/llvm/llvm-project/pull/112101 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -150,8 +150,8 @@ void test(std::string s, std::string_view sv, sub_string ss, sub_sub_string sss, // CHECK-FIXES: puv.starts_with("a"); puvf.find("a") == 0; - // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with - // CHECK-FIXES: puvf.starts_with("a")

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-13 Thread Julian Schmidt via cfe-commits
@@ -82,34 +84,25 @@ UseStartsEndsWithCheck::UseStartsEndsWithCheck(StringRef Name, void UseStartsEndsWithCheck::registerMatchers(MatchFinder *Finder) { const auto ZeroLiteral = integerLiteral(equals(0)); - const auto HasStartsWithMethodWithName = [](const std::string &Name

[clang-tools-extra] [clangd] Let DefineOutline tweak handle member functions (PR #95235)

2024-10-13 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. > @5chmidti since you've already looked at this, I'd be happy for you to > approve this if you're comfortable doing so. Sure https://github.com/llvm/llvm-project/pull/95235 ___ cfe-commits maili

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

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

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-12 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/112101 Rewrite the AST matchers for slightly more composability and performance. Furthermore, check that the `starts_with` and `ends_with` functions return a `bool`. There is one behavioral change, in that the methods

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-12 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Note that his is not an NFC due to the change in what method may be found first, but given that it's quite out there to have 2+ of `{'starts_with', 'startsWith', 'startswith'}` in one class hierarchy, which is how the non-NFC part could be observed. Because of this I think thi

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-12 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/112101 >From cd6de859501e8c0102aa1c1e57341ecc35266ed1 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 12 Oct 2024 18:07:38 +0200 Subject: [PATCH 1/2] [clang-tidy] rewrite matchers in modernize-use-starts-end

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-10-15 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > I have read the issues in detail and it doesn't look like it has been > resolved? But just want to filter out the content not interested in, even if > you don't use `exclude-header-filter` The output is the same as above,It will > not expand the contents(`Supppressed 3386 war

[clang] Reland: [clang][test] add testing for the AST matcher reference (PR #112168)

2024-10-14 Thread Julian Schmidt via cfe-commits
5chmidti wrote: The last five commits are the cumulative changes for fixing the Buildbots. I will check in with the Buildbot owner to see if the previous issue has been solved by [4a85fa3](https://github.com/llvm/llvm-project/pull/112168/commits/4a85fa3594e3fea25b9d6e90f9c4a02054f7d05d) https

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

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

[clang-tools-extra] [clang-tidy] insert ``static`` keyword in correct position for misc-use-internal-linkage (PR #108792)

2024-10-09 Thread Julian Schmidt via cfe-commits
@@ -110,10 +113,36 @@ static constexpr StringRef Message = "%0 %1 can be made static or moved into an anonymous namespace " "to enforce internal linkage"; +static SourceLocation getQualifiedTypeStartLoc(SourceLocation L, 5chmidti wrote: You could use

[clang-tools-extra] [clang-tidy] support `return c ? a : b;` in bugprone-return-const-ref-from-parameter (PR #107657)

2024-10-09 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/107657 >From b00b02b3d92a88fcf7d688b39d52e74e59f76ecd Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 7 Sep 2024 01:54:38 +0200 Subject: [PATCH 1/2] [clang-tidy] support `return c ? a : b;` in bugprone-retur

[clang-tools-extra] [clang-tidy] support `return c ? a : b;` in bugprone-return-const-ref-from-parameter (PR #107657)

2024-10-09 Thread Julian Schmidt via cfe-commits
@@ -15,20 +16,24 @@ using namespace clang::ast_matchers; namespace clang::tidy::bugprone { void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher( - returnStmt( - hasReturnValue(declRefExpr( - to(parmVarD

[clang-tools-extra] [NFC][clang-tidy] Add type annotations to rename_check.py (PR #108443)

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

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

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

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti requested changes to this pull request. I've added comments for cleaning up the implementation, and also questions/suggestions for future enhancements that are prefixed with `~:`. I went with basically-NFC-cleanups, instead of improvements, in order to have this PR

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,35 @@ +.. title:: clang-tidy - bugprone-nondeterministic-pointer-iteration-order + +bugprone-nondeterministic-pointer-iteration-order += + +Finds nondeterministic usages of pointers in unordered containers. + +One canonica

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,45 @@ + +#ifndef _SIM_SET +#define _SIM_SET + +#pragma clang system_header +#include "sim_initializer_list" + +namespace std { + +template< class T = void > +struct less; + +template< class T > +struct allocator; + +template< class Key > +struct hash; + +template< + cl

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,36 @@ +#ifndef _SIM_UNORDERED_SET +#define _SIM_UNORDERED_SET + +#pragma clang system_header +#include "sim_initializer_list" + +namespace std { + +template< + class Key, + class Hash = std::hash, + class Compare = std::less, + class Alloc = std::allocator +> class

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -174,6 +175,8 @@ class BugproneModule : public ClangTidyModule { "bugprone-multiple-new-in-one-expression"); CheckFactories.registerCheck( "bugprone-multiple-statement-macro"); +CheckFactories.registerCheck( +"bugprone-nondeterministic-pointer

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- NondetermnisticPointerUsageCheck.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: Apa

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,35 @@ + +#ifndef _SIM_MAP +#define _SIM_MAP + +#pragma clang system_header +#include "sim_stl_pair" + +namespace std { + +template +class map { + public: + using value_type = pair; + map(); + map(initializer_list> initList); + value_type& operator[](const Key& key)

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

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

[clang] [clang-tools-extra] RFC: [clang-tidy] [analyzer] Move nondeterministic pointer usage check to tidy (PR #110471)

2024-10-08 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > I'd like to keep the scope limited for this PR to just moving the static > analysis checks to a single clang-tidy check. Would that be ok with the > reviewers? Fine with me, yes, but there needs to be some sort of plan on how to address some of the pointed out challenges wit

[clang-tools-extra] [clang-tidy] Improved readability redundant casting with enums (PR #111424)

2024-10-08 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > Fixed false negatives with readability-redundant-casting when the underlying > types are the same and the option IgnoreTypeAliases is set to true. To me, > Fixed false negatives with readability-redundant-casting when casting an enum > to its underlying type and the option I

[clang-tools-extra] [clang-tidy] Make `P +- BS / sizeof(*P)` opt-outable in `bugprone-sizeof-expression` (PR #111178)

2024-10-11 Thread Julian Schmidt via cfe-commits
@@ -352,21 +352,30 @@ void good13(void) { int Buffer[BufferSize]; int *P = &Buffer[0]; - while (P < (Buffer + sizeof(Buffer) / sizeof(int))) { + while (P < Buffer + sizeof(Buffer) / sizeof(int)) { // NO-WARNING: Calculating the element count of the buffer here, whic

[clang-tools-extra] [clang-tidy] Make `P +- BS / sizeof(*P)` opt-outable in `bugprone-sizeof-expression` (PR #111178)

2024-10-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Basically LGTM, but the name `WarnOnArithmeticWithDivisionBySizeOf` would imply that ```c++ (Buffer - Buffer) / sizeof(*Buffer); ``` would be ignored as well when the flag is `false`. Please add something in the documentation about this. The option could a

[clang-tools-extra] [clang-tidy] Make `P +- BS / sizeof(*P)` opt-outable in `bugprone-sizeof-expression` (PR #111178)

2024-10-11 Thread Julian Schmidt via cfe-commits
@@ -221,6 +221,17 @@ and the result is typically unintended, often out of bounds. ``Ptr + sizeof(T)`` will offset the pointer by ``sizeof(T)`` elements, effectively exponentiating the scaling factor to the power of 2. +Similarly, multiplying or dividing a numeric value with t

[clang-tools-extra] [clang-tidy] Make `P +- BS / sizeof(*P)` opt-outable in `bugprone-sizeof-expression` (PR #111178)

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

[clang-tools-extra] [clang-tidy][modernize-use-starts-ends-with] Add support for two ends_with patterns (PR #110448)

2024-10-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM (got ideas on writing a small part of the matchers differently for an NFC I'll do afterward) https://github.com/llvm/llvm-project/pull/110448 ___ cfe-commits mailing list cfe-commits@lists.

[clang] [clang-tools-extra] [analyzer][clang-tidy][NFC] Clean up eagerly-assume handling (PR #112209)

2024-10-16 Thread Julian Schmidt via cfe-commits
=?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy , =?utf-8?q?Donát?= Nagy Message-ID: In-Reply-To: https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/112209 ___ cfe-commits mailing list cfe-commits@li

[clang-tools-extra] [clang-tidy] rewrite matchers in modernize-use-starts-ends-with (PR #112101)

2024-10-18 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti closed https://github.com/llvm/llvm-project/pull/112101 ___ 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 `return c ? a : b;` in bugprone-return-const-ref-from-parameter (PR #107657)

2024-10-10 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/107657 ___ 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 `return c ? a : b;` in bugprone-return-const-ref-from-parameter (PR #107657)

2024-10-10 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/107657 >From b00b02b3d92a88fcf7d688b39d52e74e59f76ecd Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 7 Sep 2024 01:54:38 +0200 Subject: [PATCH 1/3] [clang-tidy] support `return c ? a : b;` in bugprone-retur

[clang-tools-extra] [clang-tidy] support `return c ? a : b;` in bugprone-return-const-ref-from-parameter (PR #107657)

2024-10-10 Thread Julian Schmidt via cfe-commits
@@ -15,20 +16,24 @@ using namespace clang::ast_matchers; namespace clang::tidy::bugprone { void ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher( - returnStmt( - hasReturnValue(declRefExpr( - to(parmVarD

[clang-tools-extra] [llvm] [clangd] Add CodeAction to swap operands to binary operators (PR #78999)

2024-10-02 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > @5chmidti this should be ready for merge Yep. Though, please check out: https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it/74223 TLDR: LLVM wants commit emails that can be reached out to. I have created a new email address for this to separa

[clang-tools-extra] [clang-tidy] Create bugprone-bit-cast-pointers check (PR #108083)

2024-10-02 Thread Julian Schmidt via cfe-commits
5chmidti wrote: > What about `bugprone-bitwise-pointer-copy` @5chmidti ? > `bugprone-bitwise-pointer-cast` could work as well Both sound good to me. https://github.com/llvm/llvm-project/pull/108083 ___ cfe-commits mailing list cfe-commits@lists.llvm.

[clang-tools-extra] [clang-tidy][readability-container-contains] Fix matching of non-binaryOperator cases (PR #110386)

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

[clang-tools-extra] [clang-tidy] exclude CXXParenListInitExpr from RedundantCastingCheck (PR #109741)

2024-10-02 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/109741 ___ 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 insertion location for function pointers in cppcoreguidelines-init-variables (PR #112091)

2024-10-12 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/112091 Previously, the insertion location for the `= nullptr` fix would be after the variable name. However, if the variable is of type function pointer that is not an alias, then the insertion would happen inside the

[clang-tools-extra] [clang-tidy] fix insertion location for function pointers in cppcoreguidelines-init-variables (PR #112091)

2024-10-12 Thread Julian Schmidt via cfe-commits
@@ -185,9 +189,9 @@ Changes in existing checks false positive for C++23 deducing this. - Improved :doc:`modernize-avoid-c-arrays - ` check to suggest using ``std::span`` - as a replacement for parameters of incomplete C array type in C++20 and - ``std::array`` or ``std:

[clang-tools-extra] [clang-tidy] fix insertion location for function pointers in cppcoreguidelines-init-variables (PR #112091)

2024-10-12 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/112091 >From 6398453039602d28294cbb46e853576c9988a7d6 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 12 Oct 2024 12:34:13 +0200 Subject: [PATCH 1/2] [clang-tidy] fix insertion location for function pointers

[clang-tools-extra] Add option to exclude headers from clang-tidy analysis (PR #91400)

2024-10-14 Thread Julian Schmidt via cfe-commits
5chmidti wrote: This feature works as intended, it is only for filtering out diagnosed issues, not for skipping the analysis in those files. See #52959 for the feature you are looking for. TLDR: clang-tidy currently does not skip the analysis in (system) header files, `exclude-header-filter` i

[clang-tools-extra] [clang-tidy] Create bugprone-incorrect-enable-shared-from-this check (PR #102299)

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

[clang-tools-extra] Extend bugprone-use-after-move check to handle std::optional::reset() and std::any::reset() (PR #114255)

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

[clang-tools-extra] Extend bugprone-use-after-move check to handle std::optional::reset() and std::any::reset() (PR #114255)

2024-11-01 Thread Julian Schmidt via cfe-commits
@@ -279,7 +281,7 @@ void UseAfterMoveFinder::getDeclRefs( if (DeclRef && BlockMap->blockContainingStmt(DeclRef) == Block) { // Ignore uses of a standard smart pointer that don't dereference the // pointer. - if (Operator || !isStandardSmartP

[clang-tools-extra] Extend bugprone-use-after-move check to handle std::optional::reset() and std::any::reset() (PR #114255)

2024-11-01 Thread Julian Schmidt via cfe-commits
@@ -196,9 +196,10 @@ Any occurrence of the moved variable that is not a reinitialization (see below) is considered to be a use. An exception to this are objects of type ``std::unique_ptr``, -``std::shared_ptr`` and ``std::weak_ptr``, which have defined move behavior -(objects

[clang-tools-extra] Extend bugprone-use-after-move check to handle std::optional::reset() and std::any::reset() (PR #114255)

2024-11-05 Thread Julian Schmidt via cfe-commits
@@ -279,7 +281,7 @@ void UseAfterMoveFinder::getDeclRefs( if (DeclRef && BlockMap->blockContainingStmt(DeclRef) == Block) { // Ignore uses of a standard smart pointer that don't dereference the // pointer. - if (Operator || !isStandardSmartP

[clang-tools-extra] Extend bugprone-use-after-move check to handle std::optional::reset() and std::any::reset() (PR #114255)

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

<    4   5   6   7   8   9   10   11   12   13   >