[clang-tools-extra] [clang-tidy] Add an option to treat warnings as errors (PR #128221)

2025-03-15 Thread Carlos Galvez via cfe-commits
@@ -97,6 +97,9 @@ Improvements to clang-tidy Note: this may lead to false negatives; downstream users may need to adjust their checks to preserve existing behavior. +- Improved :program:`clang-tidy-diff.py` script. Add the `-warnings-as-errors` carlosgalve

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-15 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: @PiotrZSL @5chmidti @HerrCai0907 Do you have any objections to this patch? I would like to go ahead and land it now that all tests pass. The more we delay this, the higher the risk that new ch

[clang-tools-extra] [NFC][clang-tidy] Remove {{^}} clauses in some tests (1/N) (PR #134737)

2025-04-08 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/134737 ___ 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 `cert-err33-c` to ignore functions with same prefixes as target (PR #135160)

2025-04-11 Thread Carlos Galvez via cfe-commits
=?utf-8?q?Bj=C3=B6rn?= Svensson , =?utf-8?q?Bj=C3=B6rn?= Svensson Message-ID: In-Reply-To: @@ -50,183 +50,183 @@ namespace { // with NULL argument and in this case the check is not applicable: // `mblen, mbrlen, mbrtowc, mbtowc, wctomb, wctomb_s`. // FIXME: The check can be

[clang-tools-extra] [clang-tidy] Fix `cert-err33-c` to ignore functions with same prefixes as target (PR #135160)

2025-04-11 Thread Carlos Galvez via cfe-commits
=?utf-8?q?Björn?= Svensson , =?utf-8?q?Björn?= Svensson Message-ID: In-Reply-To: https://github.com/carlosgalvezp closed https://github.com/llvm/llvm-project/pull/135160 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/c

[clang-tools-extra] [clang-tidy][NFC] fix `clang-tidy` warnings in `clang-tools-extra/clang-tidy` directory (PR #136097)

2025-04-17 Thread Carlos Galvez via cfe-commits
@@ -209,12 +209,14 @@ bool isQualificationConvertiblePointer(QualType From, QualType To, // cv-decomposition of T, that is, cv_1, cv_2, ... , cv_n, is called the // cv-qualification signature of T. - auto isValidP_i = [](QualType P) { + // NOLINTNEXTLINE (readability-id

[clang-tools-extra] [NFC][clang-tidy] Remove {{^}} clauses in some tests (3/N) (PR #135826)

2025-04-16 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/135826 ___ 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] Remove {{^}} clauses in some tests (2/N) (PR #135824)

2025-04-17 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/135824 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-20 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/134774 ___ 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] fix `clang-tidy` warnings in `clang-tools-extra/clang-tidy` directory (PR #136097)

2025-04-20 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp closed https://github.com/llvm/llvm-project/pull/136097 ___ 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] fix `clang-tidy` warnings in `clang-tools-extra/clang-tidy` directory (PR #136097)

2025-04-20 Thread Carlos Galvez via cfe-commits
@@ -209,12 +209,14 @@ bool isQualificationConvertiblePointer(QualType From, QualType To, // cv-decomposition of T, that is, cv_1, cv_2, ... , cv_n, is called the // cv-qualification signature of T. - auto isValidP_i = [](QualType P) { + // NOLINTNEXTLINE (readability-id

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-20 Thread Carlos Galvez via cfe-commits
@@ -122,7 +122,10 @@ void UseDesignatedInitializersCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( initListExpr( hasType(cxxRecordDecl(RestrictToPODTypes ? isPOD() : isAggregate(), -unless(HasBaseWithFields))

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-20 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp requested changes to this pull request. Please add a unit test demonstrating that the related issue is fixed. https://github.com/llvm/llvm-project/pull/134774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-20 Thread Carlos Galvez via cfe-commits
@@ -182,6 +182,11 @@ Changes in existing checks ``constexpr`` and ``static``` values on member initialization and by detecting explicit casting of built-in types within member list initialization. +- Improved :doc:`modernize-use-designated-initializers + ` check by avoid

[clang-tools-extra] [clang-tools-extra] Use llvm::unique (NFC) (PR #136514)

2025-04-21 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: May I ask what is the reason for this change? What problem does std::unique have that llvm::unique solves? https://github.com/llvm/llvm-project/pull/136514 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)

2025-04-17 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: This is great, thank you! I'll have a look in the coming days. https://github.com/llvm/llvm-project/pull/136167 ___ 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] fix `clang-tidy` warnings in `clang-tools-extra/clang-tidy` directory (PR #136097)

2025-04-18 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/136097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-28 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/134774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-28 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: > It can also happen in user defined class. Yes. But it's unclear what the behavior of the check should be. For `std::array`, it's clear, because one must not touch the internal element. For a user-defined type, "it depends" on how the user wants to design their struct.

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-28 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: @RiverDave Do you have permissions to land the PR, or shall I do it for you? https://github.com/llvm/llvm-project/pull/134774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/c

[clang-tools-extra] [clang-tidy] Fix false positive for cppcoreguidelines-pro-bounds-pointer-arithmetic (PR #127394)

2025-04-30 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/127394 ___ 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 for cppcoreguidelines-pro-bounds-pointer-arithmetic (PR #127394)

2025-04-30 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: LGTM in general, but won't this fail with a std::map, since the key is an integer? Please rebase on top of latest main and resolve conflicts. https://github.com/llvm/llvm-project/pull/127394 ___ cfe-commits mailing list cfe-commi

[clang-tools-extra] [clang-tidy] Fix false positive for cppcoreguidelines-pro-bounds-pointer-arithmetic (PR #127394)

2025-04-30 Thread Carlos Galvez via cfe-commits
@@ -106,6 +106,10 @@ Changes in existing checks ` check to allow specifying additional C++ member functions to match. +- Improved :doc:`cppcoreguidelines-pro-bounds-pointer-arithmetic + ` check by + fix false positives related to operator overloading and templates. -

[clang-tools-extra] [clang-tidy] Fix false positive for cppcoreguidelines-pro-bounds-pointer-arithmetic (PR #127394)

2025-04-30 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/127394 ___ 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] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-06 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: > because the cases handled by it are covered by CaptureByRefExplicit. Strange, can you explain why that's the case? Are we missing tests? https://github.com/llvm/llvm-project/pull/138504 ___ cfe-commits mailing list cfe-commits@l

[clang-tools-extra] [clang-tidy][NFC][doc] fix typos in docs. (PR #138305)

2025-05-02 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. https://github.com/llvm/llvm-project/pull/138305 ___ 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] fix typos in docs. (PR #138305)

2025-05-02 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp closed https://github.com/llvm/llvm-project/pull/138305 ___ 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] Simplify check cppcoreguidelines-missing-std-forward (PR #138504)

2025-05-06 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. https://github.com/llvm/llvm-project/pull/138504 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (PR #137286)

2025-04-24 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp created https://github.com/llvm/llvm-project/pull/137286 …dy.py Currently, run_clang_tidy.py does not correctly display the list of checks picked up from the top-level .clang-tidy file. The reason for that is that we are passing an empty string as input file.

[clang-tools-extra] [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (PR #137286)

2025-04-29 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: /cherry-pick 014ab736dc741f24c007f9861e24b31faba0e1e7 https://github.com/llvm/llvm-project/pull/137286 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (PR #137286)

2025-04-29 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp milestoned https://github.com/llvm/llvm-project/pull/137286 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (PR #137286)

2025-04-29 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: /cherry-pick [014ab73](https://github.com/llvm/llvm-project/commit/014ab736dc741f24c007f9861e24b31faba0e1e7) https://github.com/llvm/llvm-project/pull/137286 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang-tools-extra] [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (PR #137286)

2025-04-29 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp closed https://github.com/llvm/llvm-project/pull/137286 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Avoid diagnosing std::array initializations for modernize-use-designated-initializers (PR #134774)

2025-04-28 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp closed https://github.com/llvm/llvm-project/pull/134774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)

2025-04-29 Thread Carlos Galvez via cfe-commits
@@ -337,8 +337,7 @@ Allow empty enabled checks. This suppresses the "no checks enabled" error when disabling all of the checks. )"), - cl::init(false), - cl::cat(ClangTidyCategory)); +

[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)

2025-04-29 Thread Carlos Galvez via cfe-commits
@@ -370,8 +369,8 @@ static void printStats(const ClangTidyStats &Stats) { } } -static std::unique_ptr createOptionsProvider( - llvm::IntrusiveRefCntPtr FS) { +static std::unique_ptr +createOptionsProvider(llvm::IntrusiveRefCntPtr FS) { carlosgalvezp wrote:

[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)

2025-04-29 Thread Carlos Galvez via cfe-commits
@@ -266,7 +266,7 @@ ClangTidyOptions ClangTidyContext::getOptionsForFile(StringRef File) const { // Merge options on top of getDefaults() as a safeguard against options with // unset values. return ClangTidyOptions::getDefaults().merge( - OptionsProvider->getOptions

[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)

2025-04-29 Thread Carlos Galvez via cfe-commits
@@ -46,20 +46,20 @@ TEST(ClangTidyOptionsProvider, InMemoryFileSystems) { FileOptionsProvider FileOpt({}, {}, {}, FileSystem); - ClangTidyOptions File1Options = + llvm::ErrorOr File1Options = FileOpt.getOptions("ProjectRoot/SubDir1/File.cpp"); - ClangTidyOptions F

[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)

2025-04-29 Thread Carlos Galvez via cfe-commits
@@ -624,21 +623,29 @@ int clangTidyMain(int argc, const char **argv) { } SmallString<256> FilePath = makeAbsolute(FileName); - ClangTidyOptions EffectiveOptions = OptionsProvider->getOptions(FilePath); + llvm::ErrorOr EffectiveOptions = + OptionsProvider->getOptions

[clang-tools-extra] [clang-tidy] Return error code on config parse error (PR #136167)

2025-04-29 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp requested changes to this pull request. Please document the change in the Release Notes https://github.com/llvm/llvm-project/pull/136167 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang-tools-extra] [clang-tidy] Check for `-ignore-insert-conflict` support before using it in `apply_fixes` in `run-clang-tidy.py` (PR #127066)

2025-02-17 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: carlosgalvezp wrote: > should have delivered a run-clang-tidy.py that is appropriate for that > version. It shou

[clang-tools-extra] [clang-tidy]add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-18 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,30 @@ +.. title:: clang-tidy - bugprone-unintended-char-ostream-output + +bugprone-unintended-char-ostream-output +=== + +Finds unintended character output from ``unsigned char`` and ``signed char`` to an +``ostream``. + +Normally, w

[clang-tools-extra] [clang-tidy]add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-18 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,69 @@ +// RUN: %check_clang_tidy %s bugprone-unintended-char-ostream-output %t + +namespace std { + +template class basic_ostream { +public: + basic_ostream &operator<<(int); + basic_ostream &operator<<(unsigned int); +}; + +template +basic_ostream &operator<<(basic

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-19 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,69 @@ +//===--- UnintendedCharOstreamOutputCheck.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] Contributing.rst update snippet and docs (PR #129209)

2025-03-01 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp closed https://github.com/llvm/llvm-project/pull/129209 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-28 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From 1c3cd94ba1723125a065f69ec1ab689d3f9c2474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 2

[clang-tools-extra] [clang-tidy] Contributing.rst update snippet and docs (PR #129209)

2025-02-28 Thread Carlos Galvez via cfe-commits
@@ -203,6 +202,10 @@ for more information) that will find the pattern in the AST that we want to inspect. The results of the matching are passed to the ``check`` method, which can further inspect them and report diagnostics. +By default, the new check applies only to C++ code

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-28 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?G=C3=A1lvez?= , Carlos =?utf-8?q?G=C3=A1lvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: Friendly ping. https://github.com/llvm/llvm-project/pull/128150 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-07 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: > This does not sound controversial or hard. It is already controversial for clang-tidy, surely it will be even more controversial if we involve many other tools? Besides, this request involv

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-07 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: Thank you all for the valuable input! There's a lot to process :) I will summarize the feedback, hopefully I got it right: - There are more things that can be optimized (clang-tidy's HeaderFil

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-08 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: Thank you for the discussion, I'm okey with changing the code based on the feedback, namely: - move the logic to ASTMatchers, off by default - clang tidy actively enables it - document techni

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-06 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: Thank you for the quick answer! I will then proceed to rebase against latest trunk and merge :) We can look into applying the same change to the static analyzer in a separate patch. https://g

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-06 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From a05da40d6103c664e5057d8a5010bbb57424b427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 2

[clang] [clang][test] Fix -DBUILD_SHARED_LIBS build by adding depency on Targ… (PR #130105)

2025-03-06 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: Tests pass, ok to merge @nikic @kito-cheng ? https://github.com/llvm/llvm-project/pull/130105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-06 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: That's a good point. @haoNoQ @Xazax-hun @steakhal Do you see any implications on this patch when running clang static analyzer via clang-tidy? Any checks that would stop detecting issues? TLD

[clang-tools-extra] [clang-tidy][NFC]clean ConstCorrectnessCheck (PR #130493)

2025-03-11 Thread Carlos Galvez via cfe-commits
@@ -136,16 +136,14 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) { return; VariableCategory VC = VariableCategory::Value; - if (Variable->getType()->isReferenceType()) + const QualType VT = Variable->getType(); + if (VT->isReferenceType

[clang] [clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Carlos Galvez via cfe-commits
@@ -1573,19 +1574,42 @@ bool MatchASTVisitor::TraverseAttr(Attr *AttrNode) { class MatchASTConsumer : public ASTConsumer { public: MatchASTConsumer(MatchFinder *Finder, - MatchFinder::ParsingDoneTestCallback *ParsingDone) - : Finder(Finder), ParsingDone

[clang] [clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From 1c2f485beb810d46553783689ed83ca595f51354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 20 Feb 2025 12:37:15 + Subject: [PATCH] [clang-tidy] Avoid processing declarati

[clang] [clang-tools-extra] [AstMatcher]`templateArgumentCountIs` support `FunctionDecl` (PR #130416)

2025-03-11 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: Adding @AaronBallman as owner for `ASTMatchers` https://github.com/llvm/llvm-project/pull/130416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [AstMatcher]`templateArgumentCountIs` support `FunctionDecl` (PR #130416)

2025-03-11 Thread Carlos Galvez via cfe-commits
@@ -4833,6 +4833,17 @@ Narrowing Matchers +MatcherFunctionDecl>templateArgumentCountIsunsigned N +Matches if the number of template arguments equals N. + +Given + template struct C {}; -

[clang] [clang-tools-extra] [AstMatcher]`templateArgumentCountIs` support `FunctionDecl` (PR #130416)

2025-03-11 Thread Carlos Galvez via cfe-commits
@@ -6219,6 +6230,17 @@ Narrowing Matchers Usable as: MatcherFunctionDecl>, MatcherVarDecl>, Matcher

[clang-tools-extra] [clang-tidy][NFC]clean ConstCorrectnessCheck (PR #130493)

2025-03-11 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/130493 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][test] Fix -DBUILD_SHARED_LIBS build by adding depency on Targ… (PR #130105)

2025-03-11 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/130105 ___ 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] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Carlos Galvez via cfe-commits
@@ -449,6 +453,7 @@ ClangTidyASTConsumerFactory::createASTConsumer( } std::vector> Consumers; + carlosgalvezp wrote: Nope, fixed! https://github.com/llvm/llvm-project/pull/128150 ___ cfe-commits mailing list cf

[clang] [clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From 3207b26f41bc85955616dceb35dd65d66f6b9b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 20 Feb 2025 12:37:15 + Subject: [PATCH] [clang-tidy] Avoid processing declarati

[clang-tools-extra] [clang-tidy][NFC]clean ConstCorrectnessCheck (PR #130493)

2025-03-11 Thread Carlos Galvez via cfe-commits
@@ -136,16 +136,14 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) { return; VariableCategory VC = VariableCategory::Value; - if (Variable->getType()->isReferenceType()) + const QualType VT = Variable->getType(); + if (VT->isReferenceType

[clang] [clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-03-11 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From e27ec113b6d20a34816fcf8daf5206cb7c4605d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 20 Feb 2025 12:37:15 + Subject: [PATCH] [clang-tidy] Avoid processing declarati

[clang-tools-extra] [clang-tidy] Contributing.rst update snippet and docs (PR #129209)

2025-02-28 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. LGTM, thank you! https://github.com/llvm/llvm-project/pull/129209 ___ 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] Avoid processing declarations in system headers (PR #128150)

2025-03-12 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/128150 ___ 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] Avoid processing declarations in system headers (PR #128150)

2025-03-12 Thread Carlos Galvez via cfe-commits
@@ -35,19 +35,41 @@ AST_POLYMORPHIC_MATCHER_P( Builder) != Args.end(); } +bool isStdOrPosixImpl(const DeclContext *Ctx) { + if (!Ctx->isNamespace()) +return false; + + const auto *ND = cast(Ctx); + if (ND->isInline()) { +return isStdOrPo

[clang-tools-extra] [clang-tidy] Add support for `-ignore-insert-conflict` in `run-clang-tidy.py` (PR #127066)

2025-02-14 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: @@ -198,9 +198,11 @@ def find_binary(arg: str, name: str, build_path: str) -> str: def apply_fixes( args: argparse.Namespace, clang_apply_replacements_binary: str, tmpdir

[clang-tools-extra] [tool] Add support for `-ignore-insert-conflict` option in `clang-apply-replacements` (PR #127066)

2025-02-14 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: https://github.com/carlosgalvezp approved this pull request. LGTM except for some minor nits. Also, the commit message is misleading, it should be something like: [clang-tidy] Add support for `-ignore-insert-conflict` in `run

[clang-tools-extra] [tool] Add support for `-ignore-insert-conflict` option in `clang-apply-replacements` (PR #127066)

2025-02-14 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: @@ -198,9 +198,12 @@ def find_binary(arg: str, name: str, build_path: str) -> str: def apply_fixes( args: argparse.Namespace, clang_apply_replacements_binary: str, tmpdir: str ) -> None: -"""Calls clang-a

[clang-tools-extra] [tool] Add support for `-ignore-insert-conflict` option in `clang-apply-replacements` (PR #127066)

2025-02-14 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: @@ -198,9 +198,12 @@ def find_binary(arg: str, name: str, build_path: str) -> str: def apply_fixes( args: argparse.Namespace, clang_apply_replacements_binary: str, tmpdir: str ) -> None: -"""Calls clang-a

[clang-tools-extra] [clang-tidy] Add support for `-ignore-insert-conflict` in `run-clang-tidy.py` (PR #127066)

2025-02-17 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: @@ -446,6 +448,12 @@ async def main() -> None: action="store_true", help="Allow empty enabled checks.", ) +pars

[clang-tools-extra] [clang-tidy] Add support for `-ignore-insert-conflict` in `run-clang-tidy.py` (PR #127066)

2025-02-17 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/127066 ___ cfe-commits maili

[clang-tools-extra] [clang-tidy] Add support for `-ignore-insert-conflict` in `run-clang-tidy.py` (PR #127066)

2025-02-17 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: @@ -446,6 +448,12 @@ async def main() -> None: action="store_true", help="Allow empty enabled checks.", ) +pars

[clang-tools-extra] [clang-tidy] Add support for `-ignore-insert-conflict` in `run-clang-tidy.py` (PR #127066)

2025-02-17 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/127066 ___ cfe-commits maili

[clang-tools-extra] [clang-tidy] Add support for `-ignore-insert-conflict` in `run-clang-tidy.py` (PR #127066)

2025-02-17 Thread Carlos Galvez via cfe-commits
Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= , Vicente Mataix =?utf-8?q?Ferrándiz?= Message-ID: In-Reply-To: @@ -446,6 +448,12 @@ async def main() -> None: action="store_true", help="Allow empty enabled checks.", ) +pars

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-21 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp created https://github.com/llvm/llvm-project/pull/128150 Currently, clang-tidy processes the entire TranslationUnit, including declarations in system headers. However, the work done in system headers is discarded at the very end when presenting results, unless

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-21 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From 18a676ba662900e3ef83d27f59f3e937645143c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 20 Feb 2025 12:37:15 + Su

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-21 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From 18a676ba662900e3ef83d27f59f3e937645143c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 2

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-21 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/128150 >From 18a676ba662900e3ef83d27f59f3e937645143c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Thu, 20 Feb 2025 12:37:15 + Subject: [PATCH] [clang-tidy] Avoid processing declarati

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,69 @@ +//===--- UnintendedCharOstreamOutputCheck.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 new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-24 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,45 @@ +.. title:: clang-tidy - bugprone-unintended-char-ostream-output + +bugprone-unintended-char-ostream-output +=== + +Finds unintended character output from ``unsigned char`` and ``signed char`` to an +``ostream``. + +Normally, w

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-22 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: carlosgalvezp wrote: > Will be better to use decorator pattern instead of ad preprocess consumer. > Most of clang-tidy check does not reply on ast matcher result in system > header. but it is maybe not suitable fo

[clang-tools-extra] [clang-tidy] Avoid processing declarations in system headers (PR #128150)

2025-02-23 Thread Carlos Galvez via cfe-commits
Carlos =?utf-8?q?Gálvez?= , Carlos =?utf-8?q?Gálvez?= Message-ID: In-Reply-To: @@ -449,6 +479,10 @@ ClangTidyASTConsumerFactory::createASTConsumer( } std::vector> Consumers; + + if (!Context.getOptions().SystemHeaders.value_or(false)) +Consumers.push_back(std::make

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-23 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,30 @@ +.. title:: clang-tidy - bugprone-unintended-char-ostream-output + +bugprone-unintended-char-ostream-output +=== + +Finds unintended character output from ``unsigned char`` and ``signed char`` to an +``ostream``. + +Normally, w

[clang-tools-extra] [clang-tidy] Add new check bugprone-unintended-char-ostream-output (PR #127720)

2025-02-20 Thread Carlos Galvez via cfe-commits
@@ -0,0 +1,69 @@ +//===--- UnintendedCharOstreamOutputCheck.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 broken HeaderFilterRegex when read from config file (PR #133582)

2025-03-30 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp updated https://github.com/llvm/llvm-project/pull/133582 >From 7c94ad36ff8eefd1d09cf303f8983d88cc25370c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20G=C3=A1lvez?= Date: Sat, 29 Mar 2025 11:55:02 + Subject: [PATCH] [clang-tidy] Fix broken HeaderFilterReg

[clang-tools-extra] [clang-tidy] Fix broken HeaderFilterRegex when read from config file (PR #133582)

2025-03-30 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: Was there anything else I should fix @HerrCai0907 ? It would be good to get this in in soon and cherrypick to branch 20. https://github.com/llvm/llvm-project/pull/133582 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http

[clang-tools-extra] [clang-tidy] Fix broken HeaderFilterRegex when read from config file (PR #133582)

2025-03-29 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp edited https://github.com/llvm/llvm-project/pull/133582 ___ 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 --match-full-lines instead of --strict-whitespace in check_clang_tidy (PR #133756)

2025-03-31 Thread Carlos Galvez via cfe-commits
@@ -172,7 +172,7 @@ void test(std::string s, std::string_view sv, sub_string ss, sub_sub_string sss, 0 != s.compare(0, sv.length(), sv); // CHECK-MESSAGES: :[[@LINE-1]]:{{[0-9]+}}: warning: use starts_with - // CHECK-FIXES: s.starts_with(sv); + // CHECK-FIXES: !s.starts

[clang-tools-extra] [clang-tidy] Use --match-full-lines instead of --strict-whitespace in check_clang_tidy (PR #133756)

2025-03-31 Thread Carlos Galvez via cfe-commits
@@ -245,15 +246,15 @@ def check_no_diagnosis(self, clang_tidy_output: str) -> None: def check_fixes(self) -> None: if self.has_check_fixes: -try_run( -[ -"FileCheck", -"-input-file=" + self.temp_f

[clang-tools-extra] [clang-tidy] Fix broken HeaderFilterRegex when read from config file (PR #133582)

2025-04-03 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: @tstellar Any chance we can cherry-pick this to the 20.x branch? https://github.com/llvm/llvm-project/pull/133582 ___ 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 broken HeaderFilterRegex when read from config file (PR #133582)

2025-04-03 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp milestoned https://github.com/llvm/llvm-project/pull/133582 ___ 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 broken HeaderFilterRegex when read from config file (PR #133582)

2025-04-03 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: /cherry-pick 6333fa5160fbde4bd2cf6afe8856695c13ab621f https://github.com/llvm/llvm-project/pull/133582 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [NFC] Fixes proposed by code sanitizer. (PR #134138)

2025-04-04 Thread Carlos Galvez via cfe-commits
carlosgalvezp wrote: In general, I don't fully understand the scope of this patch. Surely, there's thousands of things that could be improved in the codebase. Which of those belong to this patch? Reviewers can always point out things that could be improved ad infinitum, leading to a patch with

[clang-tools-extra] [NFC] Fixes proposed by code sanitizer. (PR #134138)

2025-04-04 Thread Carlos Galvez via cfe-commits
@@ -260,7 +260,7 @@ static IntegerRange createFromType(const ASTContext &Context, llvm::APSInt LowerValue(PrecisionBits + 2, /*isUnsigned*/ false); LowerValue.setBit(PrecisionBits); LowerValue.setSignBit(); -return {LowerValue, UpperValue}; +return {std::mo

[clang-tools-extra] [NFC] Fixes proposed by code sanitizer. (PR #134138)

2025-04-04 Thread Carlos Galvez via cfe-commits
https://github.com/carlosgalvezp approved this pull request. https://github.com/llvm/llvm-project/pull/134138 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3   4   5   6   >