[clang-tools-extra] [clang-tidy] Add AllowStringArrays option to modernize-avoid-c-arrays (PR #71701)

2024-01-31 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/71701 ___ 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 AllowStringArrays option to modernize-avoid-c-arrays (PR #71701)

2024-01-29 Thread Congcong Cai via cfe-commits
HerrCai0907 wrote: > It should not work, as this is not array, but pointer Agree. But it fulfills the description of this opinion, since it looks like to construct a array from string literals. It would be better to explain it in document. > incomplete array types constructed from string liter

[clang] [clang-tools-extra] [llvm] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-01-26 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/78598 >From 8fa3dc43e770025308da47f6aff309fa58c47fc3 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 18 Jan 2024 23:12:23 +0800 Subject: [PATCH 1/3] [clang] reject to capture variable in `RequiresExprBodyDe

[clang-tools-extra] [clang-tidy] Add AllowStringArrays option to modernize-avoid-c-arrays (PR #71701)

2024-01-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 commented: I may not work for ```c++ void f(const char name[]); f("111"); ``` https://github.com/llvm/llvm-project/pull/71701 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailma

[clang] [Clang][AST] fix crash in mangle lambda expression (PR #78896)

2024-01-23 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 commented: Should it change the mangle part in libcxx also? https://github.com/llvm/llvm-project/pull/78896 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang-tools-extra] [clang-tidy] Add support for lambdas in cppcoreguidelines-owning-memory (PR #77246)

2024-01-22 Thread Congcong Cai via cfe-commits
@@ -147,10 +161,52 @@ void OwningMemoryCheck::registerMatchers(MatchFinder *Finder) { // Matching on functions, that return an owner/resource, but don't declare // their return type as owner. Finder->addMatcher( - functionDecl(hasDescendant(returnStmt(hasReturnValue

[clang] 0f80f5e - [NFC] fix typo in clang/include/clang/Sema/ScopeInfo.h

2024-01-20 Thread Congcong Cai via cfe-commits
Author: Congcong Cai Date: 2024-01-20T22:43:15+08:00 New Revision: 0f80f5e362fb43a9335bd154c5f7976a96e32cfc URL: https://github.com/llvm/llvm-project/commit/0f80f5e362fb43a9335bd154c5f7976a96e32cfc DIFF: https://github.com/llvm/llvm-project/commit/0f80f5e362fb43a9335bd154c5f7976a96e32cfc.diff

[clang-tools-extra] [clang] [llvm] [clang-tidy] fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-20 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/77943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-01-19 Thread Congcong Cai via cfe-commits
HerrCai0907 wrote: > Thanks for the patch! > > Requires Expressions should be in an unevaluated context, so we should never > try to capture variables they mentioned. > > Maybe we need to test the evaluation context in either `tryCaptureVariable` > or `NeedToCaptureVariable`, rather than a sp

[clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-01-19 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/78598 >From 8fa3dc43e770025308da47f6aff309fa58c47fc3 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 18 Jan 2024 23:12:23 +0800 Subject: [PATCH 1/3] [clang] reject to capture variable in `RequiresExprBodyDe

[clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-01-19 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 edited https://github.com/llvm/llvm-project/pull/78598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-01-19 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 edited https://github.com/llvm/llvm-project/pull/78598 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-01-19 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/78598 >From 8fa3dc43e770025308da47f6aff309fa58c47fc3 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 18 Jan 2024 23:12:23 +0800 Subject: [PATCH 1/2] [clang] reject to capture variable in `RequiresExprBodyDe

[llvm] [clang] [clang-tools-extra] [clang-tidy] fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-19 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/77943 >From 537d283288f555c2bb7cff90aee89fe9b18f08b8 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 13 Jan 2024 00:31:33 +0800 Subject: [PATCH 1/4] [clang-tid]fix modernize-use-auto incorrect fix hints for

[clang-tools-extra] [clang-tidy] Fix crash in modernize-loop-convert when int is used as iterator (PR #78796)

2024-01-19 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/78796 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-apply-replacements] Deduplicate Implementation of `collectReplacementsFromDirectory` (NFC) (PR #78630)

2024-01-19 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/78630 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] reject to capture variable in `RequiresExprBodyDecl` (PR #78598)

2024-01-18 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/78598 Expression in `RequiresExprBodyDecl` is resolved as constants and should not be captured. Fixes: #69307, #76593. >From 33db497c31fd9da3a3acfc0d419dcdc396752863 Mon Sep 17 00:00:00 2001 From: Congcong Cai Da

[clang-tools-extra] [NFC][clang-tidy]improve performance for misc-unused-using-decls check (PR #78231)

2024-01-16 Thread Congcong Cai via cfe-commits
HerrCai0907 wrote: > LGTM. There is open issue for performance of this check. Consider mentioning > this in release notes as some generic performance improvement. I have also seen this issue. But after optimization, this check is still slow. I guess registering too many pattern causes performa

[clang-tools-extra] [NFC][clang-tidy]improve performance for misc-unused-using-decls check (PR #78231)

2024-01-16 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/78231 ___ 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]improve performance for misc-unused-using-decls check (PR #78231)

2024-01-16 Thread Congcong Cai via cfe-commits
HerrCai0907 wrote: > Thanks, the code looks good. Do you have any performance data after this > change? I don't run clang-tidy bench for some large project. But I do some test for some auto-generated cpp file which has lots of using, and the execution time reduce from 0.2s to 0.18s in my MAC

[clang-tools-extra] [clang-tidy] Fixes to readability-implicit-bool-conversion (PR #72050)

2024-01-15 Thread Congcong Cai via cfe-commits
@@ -173,16 +173,30 @@ StringRef getEquivalentBoolLiteralForExpr(const Expr *Expression, return {}; } +bool needsSpacePrefix(SourceLocation Loc, ASTContext &Context) { + SourceRange PrefixRange(Loc.getLocWithOffset(-1), Loc); + StringRef SpaceBeforeStmtStr = Lexer::getSour

[clang-tools-extra] [clang-tidy] Add bugprone-chained-comparison check (PR #76365)

2024-01-15 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,161 @@ +//===--- ChainedComparisonCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clang-tidy] Add bugprone-chained-comparison check (PR #76365)

2024-01-15 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,161 @@ +//===--- ChainedComparisonCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clang-tidy] Add bugprone-chained-comparison check (PR #76365)

2024-01-15 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,161 @@ +//===--- ChainedComparisonCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang-tools-extra] [clang-tidy] Add bugprone-chained-comparison check (PR #76365)

2024-01-15 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,161 @@ +//===--- ChainedComparisonCheck.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] [NFC][clang-tidy]improve performance for misc-unused-using-decls check (PR #78231)

2024-01-15 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/78231 `UnusedUsingDeclsCheck::removeFromFoundDecls` will be called with high frequency. At current time it will check every `Context`. This patch adds a cache to reduce algorithm complexity. >From ebd6f7648c7b4fee

[clang] [clang-tools-extra] [lld] [compiler-rt] [llvm] [lldb] [flang] [libcxx] [mlir] [clang-tidy]Add new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-15 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,52 @@ +//===--- AvoidNestedConditionalOperatorCheck.cpp - clang-tidy --===// HerrCai0907 wrote: fixed in 10602c2b4a662872d1aaeda1dbc58e5d6f613fda https://github.com/llvm/llvm-project/pull/78022 ___ c

[clang-tools-extra] 10602c2 - [NFC]add - at the beginning for alignment

2024-01-15 Thread Congcong Cai via cfe-commits
Author: Congcong Cai Date: 2024-01-16T07:49:07+08:00 New Revision: 10602c2b4a662872d1aaeda1dbc58e5d6f613fda URL: https://github.com/llvm/llvm-project/commit/10602c2b4a662872d1aaeda1dbc58e5d6f613fda DIFF: https://github.com/llvm/llvm-project/commit/10602c2b4a662872d1aaeda1dbc58e5d6f613fda.diff

[clang-tools-extra] [clang-tid]fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-15 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/77943 >From 537d283288f555c2bb7cff90aee89fe9b18f08b8 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 13 Jan 2024 00:31:33 +0800 Subject: [PATCH 1/4] [clang-tid]fix modernize-use-auto incorrect fix hints for

[compiler-rt] [clang-tools-extra] [lld] [clang] [lldb] [libcxx] [llvm] [mlir] [flang] [clang-tidy]Add new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-15 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/78022 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [lldb] [libcxx] [clang-tools-extra] [clang] [lld] [flang] [mlir] [compiler-rt] [clang-tidy]Add new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-15 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/78022 >From 0988bb25a35e5d50b44bf53d459098777280c3e5 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 13 Jan 2024 16:00:16 +0800 Subject: [PATCH 1/3] [clang-tidy]Add new check readability-avoid-nested-condit

[flang] [clang] [clang-tools-extra] [llvm] [compiler-rt] [mlir] [lld] [libcxx] [lldb] [clang-tidy]Add new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-14 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/78022 >From 0988bb25a35e5d50b44bf53d459098777280c3e5 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 13 Jan 2024 16:00:16 +0800 Subject: [PATCH 1/2] [clang-tidy]Add new check readability-avoid-nested-condit

[clang-tools-extra] [clang-tidy]Add new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-14 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/78022 >From 0988bb25a35e5d50b44bf53d459098777280c3e5 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 13 Jan 2024 16:00:16 +0800 Subject: [PATCH 1/2] [clang-tidy]Add new check readability-avoid-nested-condit

[clang-tools-extra] [clang-tidy]Add new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-14 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,56 @@ +//===--- AvoidNestedConditionalOperatorCheck.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: Apache-

[clang-tools-extra] [clang-tidy]Add new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-14 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,56 @@ +//===--- AvoidNestedConditionalOperatorCheck.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: Apache-

[clang-tools-extra] [clang-tidy]fix readability-implicit-bool-conversion false-positives when comparison bool bitfield (PR #77878)

2024-01-14 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/77878 ___ 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 new check readability-avoid-nested-conditional-operator (PR #78022)

2024-01-13 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/78022 Finds nested conditional operator. Nested conditional operators lead code hard to understand, so they should be splited as several statement and stored in temporary varibale. >From 0988bb25a35e5d50b44bf53d45

[clang-tools-extra] 5ca2d75 - [NFC]fix incorrect autosar link in clang-tidy doc

2024-01-12 Thread Congcong Cai via cfe-commits
Author: Congcong Cai Date: 2024-01-13T08:09:36+08:00 New Revision: 5ca2d75f2046612978ba71c4b36714b2a0a01886 URL: https://github.com/llvm/llvm-project/commit/5ca2d75f2046612978ba71c4b36714b2a0a01886 DIFF: https://github.com/llvm/llvm-project/commit/5ca2d75f2046612978ba71c4b36714b2a0a01886.diff

[clang-tools-extra] e028bee - [NFC]update autosar link in clang-tidy doc

2024-01-12 Thread Congcong Cai via cfe-commits
Author: Congcong Cai Date: 2024-01-13T08:08:11+08:00 New Revision: e028bee52ffc2ab9883d3d9a7dc66fe7b7c50a65 URL: https://github.com/llvm/llvm-project/commit/e028bee52ffc2ab9883d3d9a7dc66fe7b7c50a65 DIFF: https://github.com/llvm/llvm-project/commit/e028bee52ffc2ab9883d3d9a7dc66fe7b7c50a65.diff

[clang-tools-extra] [clang-tid]fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-12 Thread Congcong Cai via cfe-commits
@@ -405,12 +421,20 @@ void UseAutoCheck::replaceExpr( auto Diag = diag(Range.getBegin(), Message); + bool ShouldReplenishVariableName = isMutliLevelPointerToTypeLocClasses( + FirstDecl->getTypeSourceInfo()->getTypeLoc(), + {TypeLoc::FunctionProto, TypeLoc::Consta

[clang-tools-extra] [clang-tid]fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-12 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/77943 >From 537d283288f555c2bb7cff90aee89fe9b18f08b8 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 13 Jan 2024 00:31:33 +0800 Subject: [PATCH 1/3] [clang-tid]fix modernize-use-auto incorrect fix hints for

[clang-tools-extra] [clang-tidy] Fix false-positives in misc-static-assert caused by non-constexpr variables (PR #77203)

2024-01-12 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/77203 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tid]fix modernize-use-auto incorrect fix hints for pointer (PR #77943)

2024-01-12 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/77943 avoid create incorrect fix hints for pointer to array type and pointer to function type Fixes: #77891 >From 537d283288f555c2bb7cff90aee89fe9b18f08b8 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 13

[clang-tools-extra] [clang-tidy] Add readability-redundant-casting check (PR #70595)

2024-01-12 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,200 @@ +// RUN: %check_clang_tidy -std=c++11-or-later %s readability-redundant-casting %t +// RUN: %check_clang_tidy -std=c++11-or-later -check-suffix=,MACROS %s readability-redundant-casting %t -- \ +// RUN: -config='{CheckOptions: { readability-redundant-casting.

[clang-tools-extra] [clang-tidy] Add readability-redundant-casting check (PR #70595)

2024-01-12 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,242 @@ +//===--- RedundantCastingCheck.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]fix readability-implicit-bool-conversion false-positives when comparison bool bitfield (PR #77878)

2024-01-11 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/77878 Fixes: #76817 For ignoring comparison and xor operator, it needs to use ImplicitCastFromBool without ignoring exception cases. This patch splits ignoring exception cases logic from ImplicitCastFromBool and o

[clang] [clang]not lookup name containing a dependent type (PR #77587)

2024-01-11 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/77587 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]not lookup name containing a dependent type (PR #77587)

2024-01-11 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/77587 >From f6b9afa26fabb5f9dcea5615c92914bed93ef474 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Wed, 10 Jan 2024 19:27:31 +0800 Subject: [PATCH 1/2] [clang]not lookup name containing a dependent type Fixes:

[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,50 @@ +//===--- DonotreturnzerocheckCheck.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] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,50 @@ +//===--- DonotreturnzerocheckCheck.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] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,30 @@ +//===--- DonotreturnzerocheckCheck.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] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

2024-01-10 Thread Congcong Cai via cfe-commits
@@ -0,0 +1,50 @@ +//===--- DonotreturnzerocheckCheck.cpp - clang-tidy ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [clang]not lookup name containing a dependent type (PR #77587)

2024-01-10 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/77587 Fixes: #77583 bcd51aaaf8bde4b0ae7a4155d9ce3dec78fe2598 fixed part of template instantiation dependent name issues but still missing some cases This patch want to enhance the dependent name check >From f6b9a

[clang] [clang]use correct this scope to evaluate noexcept expr (PR #77416)

2024-01-09 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/77416 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]use correct this scope to evaluate noexcept expr (PR #77416)

2024-01-09 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/77416 >From 0637a482c881f5ce31fd1debbc8dcc40a05c66ba Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 9 Jan 2024 14:53:25 +0800 Subject: [PATCH 1/3] [clang]use correct this scope to evaluate noexcept expr wh

[clang] [clang]use correct this scope to evaluate noexcept expr (PR #77416)

2024-01-08 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/77416 Fixes: #77411 When substituting deduced type, noexcept expr in method should be instantiated and evaluated. ThisScrope should be switched to method context instead of origin sema context >From 0637a482c881f5

[clang-tools-extra] [clang-tidy]unused using decls only check cpp files (PR #77335)

2024-01-08 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/77335 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy]unused using decls only check cpp files (PR #77335)

2024-01-08 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/77335 >From 832bb78fd8cac372ec5560bb280f11e11be8d2e6 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 9 Jan 2024 00:41:33 +0800 Subject: [PATCH] [clang-tidy]unused using decls only check cpp files --- clang

[clang-tools-extra] [clang-tidy]unused using decls only check cpp files (PR #77335)

2024-01-08 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/77335 using decls can be used in cpp >From 39fae7adcdc97b4781911097f5f09c5bf8266d1c Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 9 Jan 2024 00:25:44 +0800 Subject: [PATCH] [clang-tidy]unused using decls

[clang] [clang-tools-extra] [clang-tidy] Improve performance of misc-const-correctness (PR #72705)

2024-01-08 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/72705 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]Transform uninstantiated ExceptionSpec in `TemplateInstantiator` (PR #77073)

2024-01-05 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/77073 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]Transform uninstantiated ExceptionSpec in `TemplateInstantiator` (PR #77073)

2024-01-05 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 edited https://github.com/llvm/llvm-project/pull/77073 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]Transform uninstantiated ExceptionSpec in `TemplateInstantiator` (PR #77073)

2024-01-05 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/77073 Fixes: #77071 `SubstituteDeducedTypeTransform` will transform type and it will visit uninstantiated `ExceptionSpecInfo`, which will cause odd behavior >From 04ef8fd566491024c8163ad3b901f8c4cebaf890 Mon Sep 1

[clang-tools-extra] [clang-tidy][misleading-indentation]ignore false-positives for line started with empty macro (PR #75061)

2023-12-27 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/75061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]get non-injected-class before finding instantiated decl (PR #70886)

2023-12-26 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/70886 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][misleading-indentation]ignore false-positives for line started with empty macro (PR #75061)

2023-12-26 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/75061 >From c3938da3a94ed9a9cc86d006d4b39dc5b73e7114 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Mon, 11 Dec 2023 23:32:32 +0800 Subject: [PATCH] [clang-tidy][misleading-indentation]ignore false-positives fo

[clang-tools-extra] [clang] [clang-tidy] Improve performance of misc-const-correctness (PR #72705)

2023-12-11 Thread Congcong Cai via cfe-commits
@@ -15,6 +15,76 @@ namespace clang { using namespace ast_matchers; +static bool canResolveToExprImpl(const Expr *Node, const Expr *Target) { + + const auto IgnoreDerivedToBase = [](const Expr *E, auto Matcher) { +if (Matcher(E)) + return true; +if (const auto *Ca

[clang] [clang-tools-extra] [clang-tidy] Improve performance of misc-const-correctness (PR #72705)

2023-12-11 Thread Congcong Cai via cfe-commits
@@ -15,6 +15,76 @@ namespace clang { using namespace ast_matchers; +static bool canResolveToExprImpl(const Expr *Node, const Expr *Target) { HerrCai0907 wrote: This function is hard to understand because it used matcher style naming but logic operator style

[clang] [clang-tools-extra] [clang-tidy] Improve performance of misc-const-correctness (PR #72705)

2023-12-11 Thread Congcong Cai via cfe-commits
@@ -15,6 +15,76 @@ namespace clang { using namespace ast_matchers; +static bool canResolveToExprImpl(const Expr *Node, const Expr *Target) { + + const auto IgnoreDerivedToBase = [](const Expr *E, auto Matcher) { +if (Matcher(E)) + return true; +if (const auto *Ca

[clang-tools-extra] [clang-tidy][misleading-indentation]ignore false-positives for line started with empty macro (PR #75061)

2023-12-11 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/75061 Fixes: #71767 >From e710a0568c73e87296b4df03ac6746766bd87c3a Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Mon, 11 Dec 2023 23:32:32 +0800 Subject: [PATCH] [clang-tidy][misleading-indentation]ignore fals

[clang-tools-extra] [clang-tidy][NFC][DOC] Add missing HICPP rule id's (PR #72553)

2023-11-17 Thread Congcong Cai via cfe-commits
=?utf-8?q?Bj=C3=B6rn?= Svensson Message-ID: In-Reply-To: https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/72553 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang-tools-extra] [clang-tidy] Improve performance-enum-size to exclude empty enums (PR #71640)

2023-11-08 Thread Congcong Cai via cfe-commits
@@ -23,6 +23,10 @@ namespace clang::tidy::performance { namespace { +AST_MATCHER(EnumDecl, hasEnumerators) { + return Node.enumerator_begin() != Node.enumerator_end(); HerrCai0907 wrote: ```suggestion return !Node.enumerators().empty(); ``` https://githu

[clang-tools-extra] [clang-tidy] Improve performance-enum-size to exclude empty enums (PR #71640)

2023-11-08 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 edited https://github.com/llvm/llvm-project/pull/71640 ___ 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 performance-enum-size to exclude empty enums (PR #71640)

2023-11-08 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/71640 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]get non-injected-class before finding instantiated decl (PR #70886)

2023-11-06 Thread Congcong Cai via cfe-commits
HerrCai0907 wrote: ping @erichkeane @AaronBallman @shafik @cor3ntin https://github.com/llvm/llvm-project/pull/70886 ___ 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-make-shared check (PR #70600)

2023-11-02 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/70600 ___ 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]refactor isAssignmentToMemberOf in PreferMemberInitializerCheck (PR #71006)

2023-11-02 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/71006 ___ 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]refactor isAssignmentToMemberOf in PreferMemberInitializerCheck (PR #71006)

2023-11-02 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/71006 >From 69b7688f56f7fe96031201eef1c3804f391c5abe Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 2 Nov 2023 08:49:22 +0800 Subject: [PATCH 1/2] [NFC][clang-tidy]refactor isAssignmentToMemberOf in Prefer

[clang-tools-extra] [NFC][clang-tidy]refactor isAssignmentToMemberOf in PreferMemberInitializerCheck (PR #71006)

2023-11-01 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/71006 isAssignmentToMemberOf will return `std::make_pair(nullptr, nullptr)` when failed. Using `std::optional` can describe failed case clearly. >From 69b7688f56f7fe96031201eef1c3804f391c5abe Mon Sep 17 00:00:00 2

[clang] [clang]get non-injected-class before finding instantiated decl (PR #70886)

2023-11-01 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/70886 >From 73471336857b84c69e51d4561838e588c7162bfa Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 31 Oct 2023 17:27:35 +0800 Subject: [PATCH 1/3] [clang]get non-injected-class before finding instantiated

[clang] [clang]get non-injected-class before finding instantiated decl (PR #70886)

2023-11-01 Thread Congcong Cai via cfe-commits
@@ -429,3 +429,19 @@ namespace qualified_friend_no_match { friend void Y::f(double); // expected-error {{friend declaration of 'f' does not match any declaration in 'qualified_friend_no_match::Y'}} }; } + +namespace gh21483 { +template +struct B { + struct mixin { +

[clang] [clang]get non-injected-class before finding instantiated decl (PR #70886)

2023-10-31 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/70886 Fixes #21483 >From 73471336857b84c69e51d4561838e588c7162bfa Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Tue, 31 Oct 2023 17:27:35 +0800 Subject: [PATCH 1/2] [clang]get non-injected-class before findin

[clang-tools-extra] [clang-tidy] Fix crash in modernize-use-trailing-return-type (PR #70709)

2023-10-30 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 edited https://github.com/llvm/llvm-project/pull/70709 ___ 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 crash in modernize-use-trailing-return-type (PR #70709)

2023-10-30 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. LGTM except release note https://github.com/llvm/llvm-project/pull/70709 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][test] Add more bugprone-string-constructor tests (PR #70456)

2023-10-27 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/70456 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang]set invalid for lambda which missing capture `this` (PR #70432)

2023-10-27 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/70432 It can suppression further crash. Fixes: #67687 >From c12aeb6f2a83b9cb3c3815e72d57638cf7de43a0 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Fri, 27 Oct 2023 16:51:59 +0800 Subject: [PATCH] WIP fix lambd

[clang-tools-extra] [clang-tidy]Fix PreferMemberInitializer false positive for reassignment (PR #70316)

2023-10-26 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/70316 >From 41278ca046ae5d4be4ac4ac1bc673b5010668d9c Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Thu, 26 Oct 2023 18:54:05 +0800 Subject: [PATCH 1/2] [clang-tidy]Fix PreferMemberInitializer false positive fo

[clang-tools-extra] [clang-tidy]Fix PreferMemberInitializer false positive for reassignment (PR #70316)

2023-10-26 Thread Congcong Cai via cfe-commits
@@ -570,3 +570,19 @@ struct PR52818 { int bar; }; + +struct RefReassignment { + RefReassignment(int &i) : m_i{i} { +m_i = 1; + } + int & m_i; +}; + +struct ReassignmentAfterUnsafetyAssignment { + ReassignmentAfterUnsafetyAssignment() { +int a = 10; +m_i =

[clang-tools-extra] [clang-tidy]Fix PreferMemberInitializer false positive for reassignment (PR #70316)

2023-10-26 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/70316 - assignment twice cannot be simplified to once when assigning to reference type - safe assignment cannot be advanced before unsafe assignment >From 41278ca046ae5d4be4ac4ac1bc673b5010668d9c Mon Sep 17 00:00:0

[clang-tools-extra] [clang-tidy] Improve bugprone-unused-return-value check (PR #66573)

2023-10-26 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/66573 ___ 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 StrictMode to cppcoreguidelines-pro-type-static-cast-downcast (PR #69529)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/69529 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] f5063bf - [clang-tidy][NFC]refactor PreferMemberInitializerCheck for readability

2023-10-25 Thread Congcong Cai via cfe-commits
Author: Congcong Cai Date: 2023-10-26T13:37:50+08:00 New Revision: f5063bf7edbb6368deb7354b4340eb62b8329d2e URL: https://github.com/llvm/llvm-project/commit/f5063bf7edbb6368deb7354b4340eb62b8329d2e DIFF: https://github.com/llvm/llvm-project/commit/f5063bf7edbb6368deb7354b4340eb62b8329d2e.diff

[clang-tools-extra] [clang-tidy]fix misc-unused-using-decls false positive false for using in elaborated type (PR #70230)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/70230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Improved cppcoreguidelines-narrowing-conversions.IgnoreConversionFromTypes (PR #69242)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/69242 ___ 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 StrictMode to cppcoreguidelines-pro-type-static-cast-downcast (PR #69529)

2023-10-25 Thread Congcong Cai via cfe-commits
@@ -14,3 +14,11 @@ unrelated type ``Z``. This rule is part of the `Type safety (Type.2) `_ profile from the C++ Core Guidelines. + +Options +--- + +.. option:: StrictMode + + When set to `fals

[clang-tools-extra] [clang-tidy] Support functional cast in bugprone-dangling-handle (PR #69067)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/69067 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Improved cppcoreguidelines-pro-type-const-cast (PR #69501)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 approved this pull request. https://github.com/llvm/llvm-project/pull/69501 ___ 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 misc-unused-using-decls false positive false for using in elaborated type (PR #70230)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/70230 >From 7ba5e132f50730b9e9cb392df7a2756066a7e909 Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Mon, 23 Oct 2023 09:00:26 +0800 Subject: [PATCH 1/2] [clang-tidy]fix misc-unused-using-decls false positive fa

[clang-tools-extra] [clang-tidy]fix misc-unused-using-decls false positive false for using in elaborated type (PR #70230)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 created https://github.com/llvm/llvm-project/pull/70230 `ElaboratedType` including tag keywords and any nested-name-specifiers. We should ignore nested-name-specifiers case but consider tag keywords case for `misc-unused-using-decls` check Fixes: #69714 >From 7b

[clang] [clang]improve diagnosing redefined defaulted constructor with different exception specs (PR #69688)

2023-10-25 Thread Congcong Cai via cfe-commits
https://github.com/HerrCai0907 closed https://github.com/llvm/llvm-project/pull/69688 ___ 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   7   >