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

2024-09-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,105 @@ +//===--- 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: Ap

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

2024-09-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,33 @@ +.. title:: clang-tidy - bugprone-incorrect-enable-shared-from-this + +bugprone-incorrect-enable-shared-from-this +== + +Checks if class/struct publicly inherits from +``std::enable_shared_from_this``, because otherwise whe

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

2024-09-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,105 @@ +//===--- 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: Ap

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

2024-09-11 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] [NFC][clang-tidy] fix tests of deleted functions for missing-std-forward (PR #106861)

2024-09-11 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti closed https://github.com/llvm/llvm-project/pull/106861 ___ 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-bit-cast-pointers check (PR #108083)

2024-09-11 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 check. 5chmidti wrote: nit: `check` -> `test`. `check` is

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

2024-09-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,34 @@ +//===--- BitCastPointersCheck.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-bit-cast-pointers check (PR #108083)

2024-09-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,40 @@ +.. title:: clang-tidy - bugprone-bit-cast-pointers + +bugprone-bit-cast-pointers +== + +Warns about usage of ``std::bit_cast`` when the input and output types are +pointers. + +The motivation is that ``std::bit_cast`` is advertised as the

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

2024-09-11 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,32 @@ +//===--- BitCastPointersCheck.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-public-enable-shared-from-this check (PR #102299)

2024-08-12 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti requested changes to this pull request. > maintaining the name of the matched classes in a vector and checking for > every other class if it inherits from `::std::enable_shared_from_this` or > classes in the vector. You wouldn't want to save the name, because then y

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

2024-08-12 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-public-enable-shared-from-this check (PR #102299)

2024-08-12 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 +=== + +Checks if class/struct publicly derives from ``std::enable_shared_from_this``, +because otherwise when ``s

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

2024-08-12 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,56 @@ +// RUN: %check_clang_tidy %s bugprone-incorrect-enable-shared-from-this %t -- -- + +namespace std { +template class enable_shared_from_this {}; +} //namespace std + +class BadClassExample : std::enable_shared_from_this {}; +// CHECK-MESSAGES: :[[@LINE-1]]:7

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

2024-08-12 Thread Julian Schmidt via cfe-commits
@@ -53,6 +53,7 @@ #include "ParentVirtualCallCheck.h" #include "PointerArithmeticOnPolymorphicObjectCheck.h" #include "PosixReturnCheck.h" +#include "IncorrectEnableSharedFromThisCheck.h" 5chmidti wrote: Please sort this include correctly https://github.com/l

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

2024-08-12 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,33 @@ +//===--- 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] use upper case letters for bool conversion suffix (PR #102831)

2024-08-12 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti requested changes to this pull request. Please add tests, a release notes entry, and document the option in the documentation of the check. https://github.com/llvm/llvm-project/pull/102831 ___ cfe-commits mailing list cfe-c

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

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

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

2024-08-14 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Just small things from me, looking good otherwise https://github.com/llvm/llvm-project/pull/102831 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

2024-08-14 Thread Julian Schmidt via cfe-commits
@@ -39,14 +39,22 @@ AST_MATCHER(Stmt, isNULLMacroExpansion) { } StringRef getZeroLiteralToCompareWithForType(CastKind CastExprKind, - QualType Type, - ASTContext &Context) { +

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

2024-08-14 Thread Julian Schmidt via cfe-commits
@@ -108,6 +108,10 @@ Changes in existing checks ` check to remove `->`, when reduntant `get()` is removed. +- Added option `UseUpperCaseSuffix` to :doc:`readablility-implicit-bool-conversion + ` check specify the + case of the explicit literal 5chmidti

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

2024-08-14 Thread Julian Schmidt via cfe-commits
@@ -36,6 +36,7 @@ class ImplicitBoolConversionCheck : public ClangTidyCheck { const bool AllowIntegerConditions; const bool AllowPointerConditions; + const bool UseUpperCaseSuffix; 5chmidti wrote: `UseUpperCaseLiteralSuffix` ? https://github.com/llvm/ll

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

2024-08-14 Thread Julian Schmidt via cfe-commits
@@ -133,3 +133,18 @@ Options When `true`, the check will allow conditional pointer conversions. Default is `false`. + +.. option:: UseUpperCaseSuffix + + When `true`, the check will allow new explicit conversion use an uppercase + suffix when it applies. ---

[clang-tools-extra] [clang-tidy] use upper case letters for bool conversion suffix (PR #102831)

2024-08-14 Thread Julian Schmidt via cfe-commits
@@ -36,6 +36,7 @@ class ImplicitBoolConversionCheck : public ClangTidyCheck { const bool AllowIntegerConditions; const bool AllowPointerConditions; + const bool UseUpperCaseSuffix; 5chmidti wrote: Yes, the comment is in regard to the option name. My rati

[clang-tools-extra] [clang-tidy] Add `bugprone-pointer-arithmetic-on-polymorphic-object` check (PR #91951)

2024-06-07 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/91951 ___ 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-pointer-arithmetic-on-polymorphic-object` check (PR #91951)

2024-06-07 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM minus the stored option value. (please wait for others to finish their review) https://github.com/llvm/llvm-project/pull/91951 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang-tools-extra] [clang-tidy] Add `bugprone-pointer-arithmetic-on-polymorphic-object` check (PR #91951)

2024-06-07 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,78 @@ +//===--- PointerArithmeticOnPolymorphicObjectCheck.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] Add `bugprone-pointer-arithmetic-on-polymorphic-object` check (PR #91951)

2024-06-07 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,49 @@ +//===--- VirtualArithmeticCheck.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] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-07 Thread Julian Schmidt via cfe-commits
@@ -95,9 +106,59 @@ bool ExprSequence::inSequence(const Stmt *Before, const Stmt *After) const { return true; } + SmallVector BeforeParents = getParentStmts(Before, Context); + + // Since C++17, the callee of a call expression is guaranteed to be sequenced + // bef

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-07 Thread Julian Schmidt via cfe-commits
@@ -69,6 +73,30 @@ class UseAfterMoveFinder { llvm::SmallPtrSet Visited; }; +/// Returns whether the `Before` block can reach the `After` block. +bool reaches(const CFGBlock *Before, const CFGBlock *After) { + llvm::SmallVector Stack; + llvm::SmallPtrSet Visited; + + Stac

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-07 Thread Julian Schmidt via cfe-commits
@@ -95,9 +106,59 @@ bool ExprSequence::inSequence(const Stmt *Before, const Stmt *After) const { return true; } + SmallVector BeforeParents = getParentStmts(Before, Context); + + // Since C++17, the callee of a call expression is guaranteed to be sequenced + // bef

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-07 Thread Julian Schmidt via cfe-commits
@@ -55,12 +55,23 @@ bool isDescendantOrEqual(const Stmt *Descendant, const Stmt *Ancestor, ASTContext *Context) { if (Descendant == Ancestor) return true; - for (const Stmt *Parent : getParentStmts(Descendant, Context)) { -if (isDescendantOr

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-07 Thread Julian Schmidt via cfe-commits
@@ -175,6 +218,10 @@ bool UseAfterMoveFinder::findInternal(const CFGBlock *Block, MovingCall != nullptr && Sequence->potentiallyAfter(MovingCall, Use); +// We default to false here and change this to true if required in +// find(). +

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

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

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-08 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM after fixing these two comments, but let's wait for others to review as well https://github.com/llvm/llvm-project/pull/93623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://l

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-08 Thread Julian Schmidt via cfe-commits
@@ -110,15 +117,32 @@ bool UseAfterMoveFinder::find(Stmt *CodeBlock, const Expr *MovingCall, BlockMap = std::make_unique(TheCFG.get(), Context); Visited.clear(); - const CFGBlock *Block = BlockMap->blockContainingStmt(MovingCall); - if (!Block) { + const CFGBlock *Move

[clang-tools-extra] [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments. (PR #93623)

2024-06-08 Thread Julian Schmidt via cfe-commits
@@ -35,6 +37,11 @@ struct UseAfterMove { // Is the order in which the move and the use are evaluated undefined? bool EvaluationOrderUndefined; 5chmidti wrote: While you're at it, please initialize `EvaluationOrderUndefined` to `false` as well. https://g

[clang-tools-extra] [clang-tidy] Improve bugprone-multi-level-implicit-pointer-conversion (PR #94524)

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

[clang-tools-extra] [clang-tidy] Extend modernize-use-designated-initializers with new options (PR #94651)

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

[clang-tools-extra] [clang-tidy] Ignore non-math operators in readability-math-missing-parentheses (PR #94654)

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

[clang-tools-extra] [clang-tidy] Ignore implicit functions in readability-implicit-bool-conversion (PR #94512)

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

[clang-tools-extra] [clang-tidy] Option to ignore anonymous namespaces in avoid-non-const-global-variables (PR #93827)

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

[clang-tools-extra] [clang-tidy] Option to ignore anonymous namespaces in avoid-non-const-global-variables (PR #93827)

2024-06-15 Thread Julian Schmidt via cfe-commits
5chmidti wrote: FYI: You could remove the explicit check-nots here: ```c++ // RUN: %check_clang_tidy %s -check-suffixes=,INTERNAL-LINKAGE cppcoreguidelines-avoid-non-const-global-variables %t // RUN: %check_clang_tidy %s cppcoreguidelines-avoid-non-const-globa

[clang-tools-extra] [clang-tidy] Option to ignore anonymous namespaces in avoid-non-const-global-variables (PR #93827)

2024-06-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. While I'm leaning more towards > NOLINT in the code can grab the attention of a future developer and prompt a > refactoring to avoid the pattern. , it's an off-by-default option that provides a choice. LGTM https://github.com/llvm/llvm-

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= Message-ID: In-Reply-

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= Message-ID: In-Reply-

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
=��___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= Message-ID: In-Reply-

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= Message-ID: In-Reply-

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= Message-ID: In-Reply-

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= Message-ID: In-Reply-

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-15 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= Message-ID: In-Reply-

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-06-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: The execution time of clang-tidy is a nice improvement as well. --- > What OS/Python version does this occur on? |OS|Python|Noisy Shutdown| |-|-|-| |Manjaro|3.11.9|Yes| |NixOS|3.9.19|No| |NixOS|3.10.14|No| |NixOS|3.11.9|No| |Manjaro|3.12.3|Yes| |Manjaro|3

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

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

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -501,70 +506,72 @@ def main(): # Build up a big regexy filter from all command line arguments. file_name_re = re.compile("|".join(args.files)) +files = {f for f in files if file_name_re.search(f)} -return_code = 0 +returncode = 0 try: -# S

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

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

[clang-tools-extra] [clang-tidy] Added bugprone-exception-rethrow check (PR #86448)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,83 @@ +.. title:: clang-tidy - bugprone-exception-rethrow + +bugprone-exception-rethrow +== + +Identifies problematic exception rethrowing, especially with caught exception +variables or empty throw statements outside catch blocks. + +In C++ exce

[clang-tools-extra] [clang-tidy] Added bugprone-exception-rethrow check (PR #86448)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- ExceptionRethrowCheck.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] Added bugprone-exception-rethrow check (PR #86448)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,84 @@ +.. title:: clang-tidy - bugprone-exception-rethrow + +bugprone-exception-rethrow +== + +Identifies problematic exception rethrowing, especially with caught exception +variables or empty throw statements outside catch blocks. + +In C++ exce

[clang-tools-extra] [clang-tidy] Added bugprone-exception-rethrow check (PR #86448)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- ExceptionRethrowCheck.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] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2024-06-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: @neoncube2 do you plan to continue working on this? --- Because we are emitting a fix-it, it might be a good idea to check if the return type of `c_str` is that of `data` (~possibly unwrapping aliases). https://github.com/llvm/llvm-project/pull/71304 ___

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -40,8 +40,10 @@ void ContainerDataPointerCheck::registerMatchers(MatchFinder *Finder) { cxxRecordDecl( unless(matchers::matchesAnyListedName(IgnoredContainers)), isSameOrDerivedFrom( - namedDecl( - has(cxxMethodDecl(is

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

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

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -111,16 +115,18 @@ void ContainerDataPointerCheck::check(const MatchFinder::MatchResult &Result) { MemberExpr>(CE)) ReplacementText = "(" + ReplacementText + ")"; - if (CE->getType()->isPointerType()) -ReplacementText += "->data()"; - else -Replace

[clang-tools-extra] [clang-tidy] Added bugprone-exception-rethrow check (PR #86448)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,67 @@ +//===--- ExceptionRethrowCheck.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] fix false negatives for performance-inefficient-vector-operation (PR #95667)

2024-06-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/95667 ___ 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 negatives for performance-inefficient-vector-operation (PR #95667)

2024-06-15 Thread Julian Schmidt via cfe-commits
@@ -387,3 +387,38 @@ void foo(const StructWithFieldContainer &Src) { B.push_back(Number); } } + +namespace gh95596 { + +void f(std::vector& t) { + { +std::vector gh95596_0; +// CHECK-FIXES: gh95596_0.reserve(10); +for (unsigned i = 0; i < 10; ++i) + gh95

[clang-tools-extra] [clang-tidy] fix false negatives for performance-inefficient-vector-operation (PR #95667)

2024-06-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/95667 ___ 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 negatives for performance-inefficient-vector-operation (PR #95667)

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

[clang-tools-extra] Enforce SL.con.3: Add check to replace operator[] with at() [Cont.] (PR #95220)

2024-06-17 Thread Julian Schmidt via cfe-commits
Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heidekrüger?= , Paul =?utf-8?q?Heide

[clang-tools-extra] [run-clang-tidy.py] Refactor, add progress indicator, add type hints (PR #89490)

2024-06-18 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/89490 ___ 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 option to avoid "no checks enabled" error (PR #96122)

2024-06-20 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/96122 ___ 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 option to avoid "no checks enabled" error (PR #96122)

2024-06-20 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: ´run-clang-tidy.py` and `clang-tidy-diff.py` should probably expose an option to enable this option via the script (maybe with an adjustment to the release notes). https://github.com/llvm/llvm-project/pull/96122 ___

[clang-tools-extra] [clang-tidy] add option to avoid "no checks enabled" error (PR #96122)

2024-06-20 Thread Julian Schmidt via cfe-commits
@@ -651,7 +659,7 @@ int clangTidyMain(int argc, const char **argv) { return 0; } - if (EnabledChecks.empty()) { + if (EnabledChecks.empty() && !AllowNoChecks) { llvm::errs() << "Error: no checks enabled.\n"; llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Cate

[clang-tools-extra] [clang-tidy] Check number of arguments to size/length in readability-container-size-empty (PR #93724)

2024-05-30 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. > I'm not 100% sure about release-notes entry. If it shouldn't say that check > is restricted now to zero-argument size/length. I'd use the release note as it is. Or what is your concern with it? https://github.com/llvm/llvm-project/pull/

[clang-tools-extra] [clang-tidy] Add `bugprone-pointer-arithmetic-on-polymorphic-object` check (PR #91951)

2024-05-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,49 @@ +//===--- VirtualArithmeticCheck.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] Add `bugprone-pointer-arithmetic-on-polymorphic-object` check (PR #91951)

2024-05-30 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,49 @@ +//===--- VirtualArithmeticCheck.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] fix(clang-tools-extra/**.py): fix comparison to None (PR #94013)

2024-05-31 Thread Julian Schmidt via cfe-commits
@@ -1071,7 +1071,7 @@ bool IdentifierNamingCheck::isParamInMainLikeFunction( if (!IsIntType(FDecl->parameters()[0]->getType())) return false; MainType Type = IsCharPtrPtr(FDecl->parameters()[1]->getType()); - if (Type == None) + if (Type is None) 5chm

[clang] [clang][test] add TestLanguage.def to specify all tested language versions (PR #94243)

2024-06-03 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/94243 Adds a def file to have a single location where tested language versions are specified. Removes the need to update multiple locations in the testing infrastructure to add a new language version to be tested. Te

[clang] [clang][test] add TestLanguage.def to specify all tested language versions (PR #94243)

2024-06-03 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/94243 >From 1c6f2a0a2780d3189e1cfe2a0f4ac9c3a33fcf8d Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 1 Jun 2024 17:38:37 +0200 Subject: [PATCH] [clang][test] add TestLanguage.def to specify all tested langua

[clang] [clang][test] add TestLanguage.def to specify all tested language versions (PR #94243)

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

[clang-tools-extra] [clangd] Remove potential prefix from enum value names (PR #83412)

2024-04-15 Thread Julian Schmidt via cfe-commits
@@ -125,25 +123,42 @@ llvm::Error ScopifyEnum::addClassKeywordToDeclarations() { } llvm::Error ScopifyEnum::scopifyEnumValues() { - std::string PrefixToInsert(D->getName()); - PrefixToInsert += "::"; + StringRef EnumName(D->getName()); + bool StripPrefix = true; + for (au

[clang-tools-extra] [clangd] Remove potential prefix from enum value names (PR #83412)

2024-04-15 Thread Julian Schmidt via cfe-commits
@@ -125,25 +123,42 @@ llvm::Error ScopifyEnum::addClassKeywordToDeclarations() { } llvm::Error ScopifyEnum::scopifyEnumValues() { - std::string PrefixToInsert(D->getName()); - PrefixToInsert += "::"; + StringRef EnumName(D->getName()); + bool StripPrefix = true; + for (au

[clang-tools-extra] [clangd] Remove potential prefix from enum value names (PR #83412)

2024-04-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: I think this change could use a release note in the docs, could you please add one? https://github.com/llvm/llvm-project/pull/83412 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang-tools-extra] [clangd] Remove potential prefix from enum value names (PR #83412)

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

[clang-tools-extra] [clangd] use existing function for code locations in the scopify enum tweak (PR #88737)

2024-04-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/88737 Clangd already implements some utility functions for converting between SourceLocations, Positions and Offsets into a buffer. >From 3ee0dfe6292146d188f7d14f717c1e989c668e1c Mon Sep 17 00:00:00 2001 From: Julian

[clang-tools-extra] [clangd] use existing function for code locations in the scopify enum tweak (PR #88737)

2024-04-15 Thread Julian Schmidt via cfe-commits
5chmidti wrote: @ckandeler while opening up your other changes in my editor, I wanted to see if some of the logic around `Position`s and `Offset`s could be simplified. It looks like `clangd` already implements some of the functionality in the `SourceCode.h` file. This shouldn't actually change

[clang-tools-extra] [clangd] Extract Function: add hoisting support (PR #75533)

2024-04-15 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/75533 >From b8f3f364310ca6094a6944f4f3ee9349c8aa77d6 Mon Sep 17 00:00:00 2001 From: Julian Schmidt <44101708+5chmi...@users.noreply.github.com> Date: Sat, 21 Jan 2023 14:49:58 +0100 Subject: [PATCH 1/3] [clangd] Extrac

[clang-tools-extra] [clangd] use existing function for code locations in the scopify enum tweak (PR #88737)

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

[clang-tools-extra] [clang-tidy] bugprone-lambda-function-name ignore macro in captures (PR #89076)

2024-04-17 Thread Julian Schmidt via cfe-commits
@@ -151,6 +151,10 @@ Changes in existing checks ` check to ignore code within unevaluated contexts, such as ``decltype``. +- Improved :doc:`bugprone-lambda-function-name + ` check by ignoring + ``__func__`` macro in lambda captures and nested function declaration. --

[clang-tools-extra] [clang-tidy] bugprone-lambda-function-name ignore macro in captures (PR #89076)

2024-04-17 Thread Julian Schmidt via cfe-commits
@@ -69,9 +73,13 @@ void LambdaFunctionNameCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { } void LambdaFunctionNameCheck::registerMatchers(MatchFinder *Finder) { - // Match on PredefinedExprs inside a lambda. - Finder->addMatcher(predefinedExpr(hasAncestor(lambdaEx

[clang-tools-extra] Add clang-tidy check readability-math-missing-parentheses (PR #84481)

2024-04-18 Thread Julian Schmidt via cfe-commits
5chmidti wrote: I let it run for a few minutes and didn't observe any crashes (on a release build though). However, I did find an issue with macros: ```c++ int sink(int); #define FUN(ARG) (sink(ARG)) #define FUN2(ARG) sink((ARG)) #define FUN3(ARG) sink(ARG) void f() { ... //CHECK-MESSA

[clang] [clang][Index] check `TemplateTypeParmTypeLoc ::getDecl()` against `nullptr` in `TypeIndexer` and `CursorVisitor` (PR #89392)

2024-04-19 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/89392 In the added testcase, which is invalid code, the result of `getDecl()` called on a `TemplateTypeParmTypeLoc` was a `nullptr`. However, `IndexingContext::handleReference` expects the parameter `D` to not be a `

[clang] [clang][Index] check `TemplateTypeParmTypeLoc::getDecl()` against `nullptr` in `TypeIndexer` and `CursorVisitor` (PR #89392)

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

[clang] [clang][Index] check `TemplateTypeParmTypeLoc::getDecl()` against `nullptr` in `TypeIndexer` and `CursorVisitor` (PR #89392)

2024-04-19 Thread Julian Schmidt via cfe-commits
5chmidti wrote: CC @hokein https://github.com/llvm/llvm-project/pull/89392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] bugprone-lambda-function-name ignore macro in captures (PR #89076)

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

[clang-tools-extra] Add ignoring paren imp casts in has any argument (PR #89509)

2024-04-21 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti requested changes to this pull request. I started taking a look at this and realized you switched up which argument matcher needs the extra `ignoringParenImpCasts`, so that it can be removed from the matcher definition. See https://github.com/llvm/llvm-project/blob

[clang-tools-extra] Add ignoring paren imp casts in has any argument (PR #89509)

2024-04-21 Thread Julian Schmidt via cfe-commits
@@ -74,8 +74,9 @@ RewriteRuleWith StringviewNullptrCheckImpl() { auto BasicStringViewConstructingFromNullExpr = cxxConstructExpr( HasBasicStringViewType, argumentCountIs(1), - hasAnyArgument(/* `hasArgument` would skip over parens */ anyOf( -

[clang-tools-extra] Add ignoring paren imp casts in has any argument (PR #89509)

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

[clang-tools-extra] Add ignoring paren imp casts in has any argument (PR #89509)

2024-04-21 Thread Julian Schmidt via cfe-commits
@@ -90,8 +91,9 @@ RewriteRuleWith StringviewNullptrCheckImpl() { auto HandleTemporaryCXXTemporaryObjectExprAndCompoundLiteralExpr = makeRule( cxxTemporaryObjectExpr(cxxConstructExpr( HasBasicStringViewType, argumentCountIs(1), - hasAnyArgument(/* `has

[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

2024-04-21 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,35 @@ +//===--- ReturnConstRefFromParameterCheck.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

<    1   2   3   4   5   6   7   8   9   10   >