[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-05-02 Thread Balázs Kéri via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. balazske marked an inline comment as done. Closed by commit rG1aa36da15369: [clang-tidy] Add check bugprone-multiple-new-in-one-expression. (authored by balazske). Cha

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-04-12 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done. balazske added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp:44-45 +return BinOp->getOpcode() == BO_Assign && + BinOp->getRHS()->IgnoreParenCasts() == E; + + return

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-04-12 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 512808. balazske added a comment. Simplified AST matchers a bit. Added check for list-initialization syntax at constructor call. Added some tests. Updated documentation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-04-11 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked an inline comment as done. balazske added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp:91 + ExceptionType, ExceptionReferenceType))); + auto BadAllocCatchingTryBlock =

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-04-11 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp:91 + ExceptionType, ExceptionReferenceType))); + auto BadAllocCatchingTryBlock = cxxTryStmt(hasHandlerFor(CatchBadAllocType

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-04-11 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 512425. balazske added a comment. Fixed documentation issues. Check is added to list.rst. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138777/new/ https://reviews.llvm.org/D138777 Files: clang-tools-extra/

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-02-15 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 497654. balazske added a comment. make check available in all C++ versions, add compound operator related test and code Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138777/new/ https://reviews.llvm.org/D1387

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2023-02-14 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.cpp:44-45 +return BinOp->getOpcode() == BO_Assign && + BinOp->getRHS()->IgnoreParenCasts() == E; + + return isa(ParentE); In genera

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-12-07 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a reviewer: whisperity. balazske added a comment. Herald added a subscriber: rnkovacs. This check is not about removing any use of `new`. It is only about the memory leak problem that is easy to detect and mentioned in the CppCoreGuidelines and CERT MEM52-CPP rules. If it is moved

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-11-29 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. CppCoreGuidelines rule r13-perform-at-most-one-explicit-resource-allocation-in-a-single-expression-statement

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-11-28 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment. I'm really not sure this is the right approach to solve the problem. If the concern here is leaking on exceptions, then the goalpost should be flagging all calls to global new and recommend a smart pointer factory instead. I think that check could even be made as a cpp

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-11-28 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. bitcoin, contour, qtbase, xerces was checked but nothing was detected by the check. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138777/new/ https://reviews.llvm.org/D138777 _

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-11-28 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/MultipleNewInOneExpressionCheck.h:25 + bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { +return LangOpts.CPlusPlus11; + } I think check is

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-11-28 Thread Daniel Krupp via Phabricator via cfe-commits
dkrupp added a comment. Thanks for this new check. Could you please link here results of this checker on som relevant open source projects? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138777/new/ https://reviews.llvm.org/D138777 ___

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-11-28 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment. Some of the code is copied from `UnhandledExceptionAtNewCheck`. Probably these checks can be merged into one `NewExceptionHandlingCheck`? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138777/new/ https://reviews.llvm.org/

[PATCH] D138777: [clang-tidy] Add check bugprone-multiple-new-in-one-expression.

2022-11-28 Thread Balázs Kéri via Phabricator via cfe-commits
balazske created this revision. Herald added subscribers: carlosgalvezp, steakhal, martong, gamesh411, Szelethus, dkrupp, xazax.hun. Herald added a reviewer: njames93. Herald added a project: All. balazske requested review of this revision. Herald added a project: clang-tools-extra. Herald added a