[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)

2024-05-09 Thread Julian Schmidt via cfe-commits
@@ -226,6 +226,11 @@ def run_clang_tidy(self): print("--") return clang_tidy_output +def check_no_diagnosis(self, clang_tidy_output): +print(clang_tidy_output) +if

[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)

2024-05-09 Thread Julian Schmidt via cfe-commits
@@ -172,12 +173,11 @@ def get_prefixes(self): ) if not has_check_fix and not has_check_message and not has_check_note: -sys.exit( -"%s, %s or %s not found in the input" -% (self.fixes.prefix,

[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)

2024-05-09 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Overall LGTM, just two small nits. W.r.t flag or no flag: This seems to be so rarely used (judging from the single test file that needed modification), that not having the flag is fine IMO. A check writer doesn't have to know about this

[clang-tools-extra] [clang-tidy] support expect no diagnosis test (PR #91293)

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

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

2024-05-09 Thread Julian Schmidt via cfe-commits
@@ -311,7 +311,12 @@ ClangTidyDiagnosticConsumer::ClangTidyDiagnosticConsumer( : Context(Ctx), ExternalDiagEngine(ExternalDiagEngine), RemoveIncompatibleErrors(RemoveIncompatibleErrors), GetFixesFromNotes(GetFixesFromNotes), -

[clang-tools-extra] [NFC][clang-tidy]increase stability for bugprone-return-const-ref-from-parameter (PR #91160)

2024-05-06 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Is there something specific you hit (test-case)? Either way, it's good to check https://github.com/llvm/llvm-project/pull/91160 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

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

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

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

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

2024-05-05 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,79 @@ +//===--- UseInternalLinkageCheck.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:

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

2024-05-05 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Regarding unit build: `google-global-names-in-headers` is one of the checks that check file extensions:

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

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

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

2024-05-05 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,79 @@ +//===--- UseInternalLinkageCheck.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:

[clang-tools-extra] [clang-tidy] new check misc-use-internal-linkage (PR #90830)

2024-05-05 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,79 @@ +//===--- UseInternalLinkageCheck.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:

[clang-tools-extra] [clang-tidy][docs] Fix modernize-use-std-print docs (PR #91069)

2024-05-05 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti closed https://github.com/llvm/llvm-project/pull/91069 ___ 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-positives for templates in `bugprone-return-const-ref-from-parameter` (PR #90273)

2024-05-05 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti closed https://github.com/llvm/llvm-project/pull/90273 ___ 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 modernize-use-std-print diagnostic (PR #91071)

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

[clang-tools-extra] [clang-tidy][docs] Fix modernize-use-std-print docs (PR #91069)

2024-05-04 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/91069 ___ 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 modernize-use-std-format check (PR #90397)

2024-05-03 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/90397 ___ 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 modernize-use-std-format check (PR #90397)

2024-05-03 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Just nits, otherwise LGTM! https://github.com/llvm/llvm-project/pull/90397 ___ 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 modernize-use-std-format check (PR #90397)

2024-05-03 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,107 @@ +//===--- UseStdFormatCheck.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:

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

2024-05-03 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,84 @@ +.. title:: clang-tidy - modernize-use-std-format + +modernize-use-std-format + + +Converts calls to ``absl::StrFormat``, or other functions via +configuration options, to C++20's ``std::format``, or another function +via a configuration

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

2024-05-03 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Should the check options use the simpler format? E.g. ``` CheckOptions: modernize-use-std-format.StrFormatLikeFunctions: 'unqualified_strprintf;::strprintf; mynamespace::strprintf2' ``` https://github.com/llvm/llvm-project/pull/90397

[clang-tools-extra] [clang-tidy] Add modernize-use-std-format check (PR #90397)

2024-05-03 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/90397 ___ 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 modernize-use-std-format check (PR #90397)

2024-05-03 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,107 @@ +//===--- UseStdFormatCheck.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:

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

2024-05-03 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti closed 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] [clangd] use existing functions for code locations in the scopify enum tweak (PR #88737)

2024-05-03 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] fix false-positives for templates in `bugprone-return-const-ref-from-parameter` (PR #90273)

2024-05-02 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti updated https://github.com/llvm/llvm-project/pull/90273 >From 9b5bf4e1d53b3a55f9290199aeccb02c20a1e2cc Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Fri, 26 Apr 2024 22:49:38 +0200 Subject: [PATCH 1/2] [clang-tidy] fix false-positives for templates in

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

2024-05-02 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM 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] Remove potential prefix from enum value names (PR #83412)

2024-05-01 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: When the enumerators start with the enum name, but the names contain a `_` as a separator, then applying this tweak will result in `_`-prefixed enumerators. Can you please handle that case as well and remove the `_`? Otherwise, this looks good to me

[clang-tools-extra] [clang-tidy] Handle implicit casts in hicpp-signed-bitwise for IgnorePositiveIntegerLiterals (PR #90621)

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

[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -380,3 +387,20 @@ namespace PR51861 { // CHECK-FIXES: {{^}}PR51861::Foo::getBar();{{$}} } } + +namespace PR75163 { 5chmidti wrote: Nit: `GH` instead of `PR`? https://github.com/llvm/llvm-project/pull/90736

[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)

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

[clang-tools-extra] [clang-tidy] Handle expr with side-effects in readability-static-accessed-through-instance (PR #90736)

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

[clang-tools-extra] [clang-tidy] Relax readability-const-return-type (PR #90560)

2024-05-01 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/90560 ___ 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 casts from void to void in bugprone-casting-through-void (PR #90566)

2024-05-01 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/90566 ___ 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 unevaluated context in bugprone-optional-value-conversion (PR #90410)

2024-05-01 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti commented: Do we maybe want to explicitly match `decltype`, `sizeof`, `static_cast` etc. instead of `typeLoc`? Because I don't think we would want to ignore https://godbolt.org/z/r3bK961do ```c++ #include constexpr std::optional foo() { return 42; } constexpr int

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

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

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -164,26 +164,32 @@ TEST_P(ASTMatchersTest, AllOf) { "void g(int x) { struct T t; f(x, , 3, 4); }"; EXPECT_TRUE(matches( Program, callExpr(allOf(callee(functionDecl(hasName("f"))), - hasArgument(0,

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -44,9 +44,10 @@ void StringFindStartswithCheck::registerMatchers(MatchFinder *Finder) { callee(cxxMethodDecl(hasName("find")).bind("findfun")), on(hasType(StringType)), // ... with some search expression ... - hasArgument(0, expr().bind("needle")), +

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -97,11 +97,12 @@ AST_MATCHER_FUNCTION_P(StatementMatcher, isConstRefReturningMethodCall, hasCanonicalType(recordType(hasDeclaration(namedDecl( unless(matchers::matchesAnyListedName(ExcludedContainerTypes)); - return expr( -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -46,20 +46,20 @@ void SlicingCheck::registerMatchers(MatchFinder *Finder) { isBaseInitializer(), withInitializer(equalsBoundNode("Call")); // Assignment slicing: "a = b;" and "a = std::move(b);" variants. - const auto SlicesObjectInAssignment = -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -30,9 +30,9 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( cxxOperatorCallExpr( argumentCountIs(2), - hasArgument( - 0, expr(hasType(cxxRecordDecl(hasName("::absl::Duration"),

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -82,8 +82,8 @@ void StringConstructorCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( cxxConstructExpr( hasDeclaration(cxxMethodDecl(hasName("basic_string"))), - hasArgument(0, hasType(qualType(isInteger(, -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -102,8 +103,8 @@ void StringConstructorCheck::registerMatchers(MatchFinder *Finder) { cxxConstructExpr( hasDeclaration(cxxConstructorDecl(ofClass( cxxRecordDecl(hasAnyName(removeNamespaces(StringNames)), - hasArgument(0,

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -75,9 +76,10 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) { hasParent(functionTemplateDecl()), unless(hasTemplateArgument(0, refersToType(builtinType(,

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Please remove the formatting changes https://github.com/llvm/llvm-project/pull/89553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -62,9 +63,9 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) { unless(hasTemplateArgument(0, refersToType(builtinType(, hasAnyName("::absl::operator*", "::absl::operator/"))),

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -22,9 +22,10 @@ void DurationDivisionCheck::registerMatchers(MatchFinder *Finder) { traverse(TK_AsIs, implicitCastExpr( hasSourceExpression(ignoringParenCasts( -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -41,14 +41,17 @@ void StringLiteralWithEmbeddedNulCheck::registerMatchers(MatchFinder *Finder) { hasDeclaration(cxxMethodDecl(hasName("basic_string", // If present, the second argument is the alloc object which must not // be present

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -36,19 +36,21 @@ void DurationUnnecessaryConversionCheck::registerMatchers(MatchFinder *Finder) { // e.g. `absl::ToDoubleSeconds(dur)`. auto InverseFunctionMatcher = callExpr( callee(functionDecl(hasAnyName(FloatConversion, IntegerConversion))), -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -98,16 +100,18 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) { // `absl::Hours(x)` // where `x` is not of a built-in type. Finder->addMatcher( - traverse(TK_AsIs, implicitCastExpr( -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

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

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -54,9 +54,10 @@ makeRewriteRule(ArrayRef StringLikeClassNames, hasParameter( 0, parmVarDecl(anyOf(hasType(StringType), hasType(CharStarType), hasType(CharType)), - on(hasType(StringType)), hasArgument(0,

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -49,7 +49,8 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) { hasParent(functionTemplateDecl()), unless(hasTemplateArgument(0, refersToType(builtinType(, hasAnyName("operator*=", "operator/="))),

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -62,9 +63,9 @@ void StringFindStartswithCheck::registerMatchers(MatchFinder *Finder) { callee(cxxMethodDecl(hasName("rfind")).bind("findfun")), on(hasType(StringType)), // ... with some search expression ... - hasArgument(0, expr().bind("needle")), +

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -21,9 +21,10 @@ void DurationSubtractionCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( binaryOperator( hasOperatorName("-"), - hasLHS(callExpr(callee(functionDecl(DurationConversionFunction()) -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -75,10 +75,11 @@ rewriteInverseDurationCall(const MatchFinder::MatchResult , getDurationInverseForScale(Scale); if (const auto *MaybeCallArg = selectFirst( "e", - match(callExpr(callee(functionDecl(hasAnyName( -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -20,7 +20,7 @@ namespace clang::tidy::abseil { void DurationConversionCastCheck::registerMatchers(MatchFinder *Finder) { auto CallMatcher = ignoringImpCasts(callExpr( callee(functionDecl(DurationConversionFunction()).bind("func_decl")), - hasArgument(0,

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
@@ -93,7 +94,8 @@ rewriteInverseTimeCall(const MatchFinder::MatchResult , llvm::StringRef InverseFunction = getTimeInverseForScale(Scale); if (const auto *MaybeCallArg = selectFirst( "e", match(callExpr(callee(functionDecl(hasName(InverseFunction))), -

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

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

[clang] [clang-tools-extra] [llvm] Add ``ignoringParenImpCasts`` in arguments of hasArgument (PR #89553)

2024-05-01 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti requested changes to this pull request. Thanks for looking into this. Because this is touching a lot of checks, there was bound to be some conversation about which matchers need the `ignoringParenImpCasts` and which don't. I think we should check that now instead

[clang-tools-extra] [clang-tidy] fix false-negative for macros in `readability-math-missing-parentheses` (PR #90279)

2024-04-26 Thread Julian Schmidt via cfe-commits
5chmidti wrote: CC @11happy (couldn't add you as a reviewer) https://github.com/llvm/llvm-project/pull/90279 ___ 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-negative for macros in `readability-math-missing-parentheses` (PR #90279)

2024-04-26 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/90279 When a binary operator is the last operand of a macro, the end location that is past the `BinaryOperator` will be inside the macro and therefore an invalid location to insert a `FixIt` into, which is why the

[clang-tools-extra] [clang-tidy] fix false-positives for templates in `bugprone-return-const-ref-from-parameter` (PR #90273)

2024-04-26 Thread Julian Schmidt via cfe-commits
5chmidti wrote: Do we add `improvement` documentation for checks that landed in the same release cycle? https://github.com/llvm/llvm-project/pull/90273 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] fix false-positives for templates in `bugprone-return-const-ref-from-parameter` (PR #90273)

2024-04-26 Thread Julian Schmidt via cfe-commits
5chmidti wrote: The false positives that are fixed by implementing this fix are in lines: 98, 101, 110, 113. The other tests are for completeness. https://github.com/llvm/llvm-project/pull/90273 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] fix false-positives for templates in `bugprone-return-const-ref-from-parameter` (PR #90273)

2024-04-26 Thread Julian Schmidt via cfe-commits
5chmidti wrote: @HerrCai0907 I was looking at false positives for templates regarding this check and ended up implementing the fix. https://github.com/llvm/llvm-project/pull/90273 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] fix false-positives for templates in `bugprone-return-const-ref-from-parameter` (PR #90273)

2024-04-26 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti created https://github.com/llvm/llvm-project/pull/90273 In the AST for function templates, the return will be a DeclRefExpr, even if the return type differs from that of the returned variable. Protect against false-positives by constraining the canonical return type

[clang-tools-extra] [clang-tidy] Ensure nullable variable is not accessed without validity test (PR #90173)

2024-04-26 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. https://github.com/llvm/llvm-project/pull/90173 ___ 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 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] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

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

[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:

[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(/*

[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
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

[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] [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] [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
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-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() { ...

[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 ) { } void LambdaFunctionNameCheck::registerMatchers(MatchFinder *Finder) { - // Match on PredefinedExprs inside a lambda. -

[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] [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] [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]

[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

[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:

[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] 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

[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

[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

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-02 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. Looks good to me (others are still reviewing), thanks https://github.com/llvm/llvm-project/pull/85572 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-02 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,255 @@ +//===--- MinMaxUseInitializerListCheck.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:

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-02 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/85572 ___ 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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-02 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,278 @@ +//===--- MinMaxUseInitializerListCheck.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:

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-02 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,255 @@ +//===--- MinMaxUseInitializerListCheck.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:

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

2024-04-01 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,97 @@ +//===--- MathMissingParenthesesCheck.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:

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

2024-04-01 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti approved this pull request. LGTM from my side, others are still reviewing. Your test file contains a few trailing whitespaces that you could remove. https://github.com/llvm/llvm-project/pull/84481 ___ cfe-commits mailing

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

2024-04-01 Thread Julian Schmidt via cfe-commits
https://github.com/5chmidti edited https://github.com/llvm/llvm-project/pull/84481 ___ 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 check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-01 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,278 @@ +//===--- MinMaxUseInitializerListCheck.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:

[clang-tools-extra] [clang-tidy] add check to suggest replacement of nested std::min or std::max with initializer lists (PR #85572)

2024-04-01 Thread Julian Schmidt via cfe-commits
@@ -0,0 +1,278 @@ +//===--- MinMaxUseInitializerListCheck.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:

<    1   2   3   4   5   6   7   >