[PATCH] D118927: [clang-tidy] Fix invalid fix-it for cppcoreguidelines-prefer-member-initializer

2022-02-04 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. LGTM. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D118927/new/ https://reviews.llvm.org/D118927

[PATCH] D118996: [clang-tidy] Support C++14 in bugprone-signal-handler.

2022-02-04 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp:41 +bool isInNoNamespace(const FunctionDecl *FD) { + const DeclContext *DC = FD->getDeclContext(); `isInGlobalNamespace` might be a better name?

[PATCH] D118711: [hack] Build a tree of preprocessing directives

2022-02-05 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 406220. LegalizeAdulthood added a comment. - Use LLVM RTTI for PP node types - Add routines to dump PP nodes CHANGES SINCE LAST ACTION https://reviews.llvm.org/D118711/new/ https://reviews.llvm.org/D118711 Files: clang-tools-extra/clang-tidy/

[PATCH] D97625: fix check-clang-tools tests that fail due to Windows CRLF line endings

2022-02-11 Thread Richard via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGfc5bf040d810: fix check-clang-tools tests that fail due to Windows CRLF line endings (authored by poelmanc, committed by LegalizeAdulthood). Herald added a project: LLVM. Herald added a subscriber: llvm-c

[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

2022-02-11 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. In D117522#3299423 , @carlosgalvezp wrote: > I'm mostly interested on the warning message, [...] I'm open to changes in the wording of the warning message. > I get an error when downloading, do you happen to know what

[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

2022-02-11 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. Mmm... just realized that this check should invalidate any macro that is used in a conditional compilation expression, because enums can't be used there. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117522/new/ https://reviews.llvm.org/D117522 __

[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

2022-02-12 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 408231. LegalizeAdulthood added a comment. Herald added subscribers: kbarton, nemanjai. - Rejects macros that are used in preprocessor conditionals - cppcoreguidelines-macro-to-enum is an alias for modernize-macro-to-enum - Document alias CHANGES S

[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

2022-02-12 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 408233. LegalizeAdulthood added a comment. - clang-format CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117522/new/ https://reviews.llvm.org/D117522 Files: clang-tools-extra/clang-tidy/modernize/CMakeLists.txt clang-tools-extra/clang-

[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

2022-02-12 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 408235. LegalizeAdulthood added a comment. - Move small methods to class decl CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117522/new/ https://reviews.llvm.org/D117522 Files: clang-tools-extra/clang-tidy/modernize/CMakeLists.txt clan

[PATCH] D117522: [clang-tidy] Add modernize-macro-to-enum check

2022-02-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. Ping. Waiting for review feedback for about a week now. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117522/new/ https://reviews.llvm.org/D117522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[PATCH] D124066: [clang-tidy] Ignore macros defined within declarations in modernize-macro-to-enum

2022-04-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:561-567 + Finder->addMatcher(varDecl(TopLevelDecl).bind("top"), this); + Finder->addMatcher(functionDecl(TopLevel

[PATCH] D124066: [clang-tidy] Ignore macros defined within declarations in modernize-macro-to-enum

2022-04-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:561-567 + Finder->addMatcher(varDecl(TopLevelDecl).bind("top"), this); + Finder->addMatcher(functionDecl(TopLevel

[PATCH] D124066: [clang-tidy] Ignore macros defined within declarations in modernize-macro-to-enum

2022-04-22 Thread Richard via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGb985b6e3c15a: [clang-tidy] Ignore macros defined within declarations (authored by LegalizeAdulthood). Changed prior to commit: https://reviews.llv

[PATCH] D124066: [clang-tidy] Ignore macros defined within declarations in modernize-macro-to-enum

2022-04-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 424663. LegalizeAdulthood added a comment. Update from review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124066/new/ https://reviews.llvm.org/D124066 Files: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp clang

[PATCH] D124316: [clang-tidy] Modernize-macro-to-enum should skip macros used in other macros

2022-04-22 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood created this revision. LegalizeAdulthood added reviewers: aaron.ballman, alexfh. LegalizeAdulthood added a project: clang-tools-extra. Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a project: All. LegalizeAdulthood requested review of this revision. If a macro

[PATCH] D124316: [clang-tidy] Modernize-macro-to-enum should skip macros used in other macros

2022-04-25 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. Gentle ping. I have another change based on this that fixes #55055 Enhance modernize-macro-to-enum to recognize constant literal expressions Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D124316: [clang-tidy] Modernize-macro-to-enum should skip macros used in other macros

2022-04-26 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 425399. LegalizeAdulthood added a comment. Update from review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124316/new/ https://reviews.llvm.org/D124316 Files: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp clang

[PATCH] D124316: [clang-tidy] Modernize-macro-to-enum should skip macros used in other macros

2022-04-26 Thread Richard via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG693246e03f28: [clang-tidy] Modernize-macro-to-enum should skip macros used in other macros (authored by LegalizeAdulthood). Repository: rG LLVM Gi

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-26 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood created this revision. LegalizeAdulthood added a reviewer: aaron.ballman. Herald added subscribers: carlosgalvezp, xazax.hun, mgorny. Herald added a project: All. LegalizeAdulthood requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscri

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-26 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:1 +#include "IntegralLiteralExpressionMatcher.h" + ditto Comment at: clang-tools-extra/clang-tidy/modernize/Integ

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-26 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 425423. LegalizeAdulthood added a comment. - Add banner block comment for new files - Extract Functions to eliminate duplication CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124500/new/ https://reviews.llvm.org/D124500 Files: clang-too

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-26 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 425425. LegalizeAdulthood added a comment. Inline Variable CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124500/new/ https://reviews.llvm.org/D124500 Files: clang-tools-extra/clang-tidy/modernize/CMakeLists.txt clang-tools-extra/clang

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-27 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:1 +#include "ClangTidyTest.h" +#include "modernize/IntegralLiteralExpressionMatcher.h" Needs a file header CHANGES SINCE LAST ACTION https://re

[PATCH] D124341: [clang-tidy][NFC] Replace many instances of std::string where a StringRef would suffice.

2022-04-27 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/ClangTidyCheck.cpp:51 ClangTidyContext *Context) -: NamePrefix(CheckName.str() + "."), CheckOptions(CheckOptions), +: NamePrefix((CheckName + ".").str()), CheckOptions(CheckOptions),

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-27 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 425679. LegalizeAdulthood added a comment. Add file block comment CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124500/new/ https://reviews.llvm.org/D124500 Files: clang-tools-extra/clang-tidy/modernize/CMakeLists.txt clang-tools-extr

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-27 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 425700. LegalizeAdulthood added a comment. Update documentation CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124500/new/ https://reviews.llvm.org/D124500 Files: clang-tools-extra/clang-tidy/modernize/CMakeLists.txt clang-tools-extra/

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-04-28 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood created this revision. LegalizeAdulthood added reviewers: aaron.ballman, njames93. LegalizeAdulthood added projects: clang-tools-extra, All. Herald added subscribers: carlosgalvezp, xazax.hun. LegalizeAdulthood requested review of this revision. Make the following simplifications

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-04-28 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. General question: There is the question of whether or not the replacement should have `()`s around the whole thing because we don't analyze the context to see if the change in precedence between `operator!` and `operator&&` or `operator||` makes any difference

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 426111. LegalizeAdulthood added a comment. Sort changes by check name in docs CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124650/new/ https://reviews.llvm.org/D124650 Files: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExpr

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 2 inline comments as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:32-33 + // not a decimal floating-point literal + return std::none_of( + Begin, End, [](cha

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 3 inline comments as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:99 + + if (!Current->isLiteral() || isStringLiteral(Current->getKind()) || + !isIntegralCons

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. In D124500#3483224 , @aaron.ballman wrote: > To clarify my previous comments, I'm fine punting on the edge cases until > user reports come in, so don't let them block this review if you feel > strongly about not suppo

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 3 inline comments as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:66 +{false, "1.23"}, +{false, "0x1p3"}, +{false, R"("string")"}, LegalizeAdulthood

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 7 inline comments as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.h:18-20 +// Parses an array of tokens and returns true if they conform to the rules of +// C++ for who

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 426160. LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added a comment. Update from review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124500/new/ https://reviews.llvm.org/D124500 Files: clang-tools-ext

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. In D124650#3481514 , @LegalizeAdulthood wrote: > General question: > > There is the question of whether or not the replacement should have `()`s > around the whole > thing because we don't analyze the context to see if

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-04-29 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 426163. LegalizeAdulthood added a comment. Surround replacements with parens CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124650/new/ https://reviews.llvm.org/D124650 Files: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprC

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-30 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:204 + return true; +} + LegalizeAdulthood wrote: > aaron.ballman wrote: > > LegalizeAdulthood wrote: > > > aaron.ballman wrote: > >

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-30 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 426263. LegalizeAdulthood added a comment. Recognize comma operator expressions CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124500/new/ https://reviews.llvm.org/D124500 Files: clang-tools-extra/clang-tidy/modernize/CMakeLists.txt cl

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-04-30 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. FYI, once nice addition of the parsing of macro bodies is that it paves the way for a modernize-macro-to-function check that converts function-like macros that compute values to template functions. Once this change has landed, I'll be putting up a review for t

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-05-01 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. Testing on VTK revealed this change: - this->SliceMapper->SetBackground((this->Background && -!(this->SliceFacesCamera && this->InternalResampleToScreenPixels && - !this->SeparateWindowLevelOperation))); + this->SliceMapper->SetBackground( +

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-05-01 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp:586 + + auto Not = hasOperatorName("!"); + auto Or = hasOperatorName("||"); njames93 wrote: > njames93 wrote: > > This whole implementati

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-05-01 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. I also noticed that some of the simplifications being performed resulted in `!(x || !y)` coming out of other parts of the simplifier, so it should be the case that running this check on your code should result in no further changes to your code if you run the

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-05-01 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp:598-599 + auto UnlessNotLHS = unless(hasLHS(NotOp)); + // match !(!a || b) + Finder->addMatcher(unary

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-02 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. In D124500#3485462 , @aaron.ballman wrote: > In D124500#3483328 , > @LegalizeAdulthood wrote: > >> In D124500#3483224 , >> @aaron.bal

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-02 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:99 + + if (!Current->isLiteral() || isStringLiteral(Current->getKind()) || + !isIntegralConstant(*Current)) { aaron.ballman wro

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-05-02 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 2 inline comments as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp:598-599 + auto UnlessNotLHS = unless(hasLHS(NotOp)); + // match !(!a || b) + Finder->addMatcher(unary

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-02 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:99 + + if (!Current->isLiteral() || isStringLiteral(Current->getKind()) || + !isIntegralConstant(*Current)) { aaron.ballman wro

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-02 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:99 + + if (!Current->isLiteral() || isStringLiteral(Current->getKind()) || + !isIntegralConstant(*Current)) { LegalizeAdulthood

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-05-02 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. In D124650#3486859 , @njames93 wrote: > I've done my own implementation, but its definitely over engineered, WDYT? > D124806 Hey, that looks great at a glance. I need to prepare for

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-08 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:99 + + if (!Current->isLiteral() || isStringLiteral(Current->getKind()) || + !isIntegralCons

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-08 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 2 inline comments as done. LegalizeAdulthood added a comment. OK, so thinking about this review a little more, I propose this: - Take the check as is, but document that the initializing expressions may result in an invalid enum, particularly for C which restricts the und

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-09 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-macro-to-enum.rst:21-22 + `,`, `-`, `+`, `*`, `/`, `%`, `&`, `|`, `^`, `<`, `>`, `<=`, `>=`, + `==`, `!=`, `||`, `&&`, `<<`, `>>` or `<=>`, and the ternary operator + `?:`.

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-09 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:99 + + if (!Current->isLiteral() || isStringLiteral(Current->getKind()) || + !isIntegralConstant(*Current)) { aaron.ballman wro

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-13 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 429353. LegalizeAdulthood added a comment. Update documentation from review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124500/new/ https://reviews.llvm.org/D124500 Files: clang-tools-extra/clang-tidy/modernize/CMakeLists.txt

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-13 Thread Richard via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG512273833136: [clang-tidy] Support expressions of literals in modernize-macro-to-enum (authored by LegalizeAdulthood). Repository: rG LLVM Github

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:210-214 +std::ostream &operator<<(std::ostream &Str, + const clang::tidy::test::Param &Value) { + return Str << "Matched: " << std::boolal

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:210-214 +std::ostream &operator<<(std::ostream &Str, + const clang::tidy::test::Param &Value) { + return Str << "Matched: " << std::boolal

[PATCH] D124341: [clang-tidy][NFC] Replace many instances of std::string where a StringRef would suffice.

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/ClangTidyCheck.cpp:56 ClangTidyCheck::OptionsView::get(StringRef LocalName) const { - const auto &Iter = CheckOptions.find(NamePrefix + LocalName.str()); + const auto &Iter = CheckOptions.find((N

[PATCH] D124918: [clang-tidy] Add a new check for non-trivial unused variables.

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:25-26 + +A function is considered to "not read an argument unless the return value is +used" in the following cases: + The quotes

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:210-214 +std::ostream &operator<<(std::ostream &Str, + const clang::tidy::test::Param &

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:210-214 +std::ostream &operator<<(std::ostream &Str, + const clang::tidy::test::Param &

[PATCH] D124500: [clang-tidy] Support expressions of literals in modernize-macro-to-enum

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked an inline comment as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/IntegralLiteralExpressionMatcher.cpp:204 + return true; +} + LegalizeAdulthood wrote: > aaron.ballman wrote: > > Lega

[PATCH] D125622: [clang-tidy] Reject invalid enum initializers in C files

2022-05-14 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood created this revision. LegalizeAdulthood added reviewers: aaron.ballman, njames93. LegalizeAdulthood added a project: clang-tools-extra. Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a project: All. LegalizeAdulthood requested review of this revision. C require

[PATCH] D125622: [clang-tidy] Reject invalid enum initializers in C files

2022-05-16 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-macro-to-enum.c:9 + +// C forbids comma operator in initializing expressions. +#define BAD_OP 1, 2 aaron.ballman wrote: > It's also forbidden in C++. C++ ju

[PATCH] D125622: [clang-tidy] Reject invalid enum initializers in C files

2022-05-16 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 2 inline comments as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-macro-to-enum.c:9 + +// C forbids comma operator in initializing expressions. +#define BAD_OP 1, 2 aaron

[PATCH] D125771: [clang-tidy] Add a useful note about -std=c++11-or-later

2022-05-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. I thought there wasn't any support for validating fixits applied to header files? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125771/new/ https://reviews.llvm.org/D125771 __

[PATCH] D124918: [clang-tidy] Add a new check for non-trivial unused variables.

2022-05-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:172-173 +List of functions that are considered not to read some of their arguments +unless their return value is read. Arguments are identified by

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp:90 + // to the `ASTContext`. + Finder->addMatcher(ast_matchers::translationUnitDecl().bind("TU"), this); +} In modernize-macro-to-enum I had t

[PATCH] D125769: [clang-tidy] Introduce the WarnIntoHeaders option to modernize-deprecated-headers

2022-05-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h:63 std::vector IncludesToBeProcessed; + bool WarnIntoHeaders; }; 1) How is this different from the clang-tidy option that specifies whether o

[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp:37 -#include // FIXME: We should have no warning into system headers. -// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning:

[PATCH] D124918: [clang-tidy] Add a new check for non-trivial unused variables.

2022-05-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/performance-unused-no-side-effect.rst:172-173 +List of functions that are considered not to read some of their arguments +unless their return value is read. Arguments are identified by

[PATCH] D125026: [clang-tidy][NFC] Reimplement SimplifyBooleanExpr with RecursiveASTVisitors

2022-05-17 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. Just for my own edification, how did you know/suspect that a pure visitor would be faster than matchers? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125026/new/ https://reviews.llvm.org/D125026 ___

[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp:37 -#include // FIXME: We should have no warning into system headers. -// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning:

[PATCH] D125874: [clang-tidy] Fix readability-simplify-boolean-expr when Ifs have an init statement or condition variable

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. Good catch! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125874/new/ https://reviews.llvm.org/D125874 __

[PATCH] D125877: [clang-tidy] Fix readability-simplify-boolean-expr crash with implicit cast in return.

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. Another good catch! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125877/new/ https://reviews.llvm.org/D125877 __

[PATCH] D125885: [clang-tidy] bugprone-argument-comment: Ignore calls to user-defined literals

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125885/new/ https://reviews.llvm.org/D125885 _

[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp:37 -#include // FIXME: We should have no warning into system headers. -// CHECK-MESSAGES-WARN-INTO-HEADERS: mysystemlib.h:1:10: warning:

[PATCH] D124806: [clang-tidy] add support for Demorgan conversions to readability-simplify-bool-expr

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. LGTM! Thanks for taking my idea and implementing it much better than what I had `:)`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews

[PATCH] D124650: [clang-tidy] Simplify boolean expressions by DeMorgan's theorem

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood abandoned this revision. LegalizeAdulthood added a comment. Discarding in favor of Nathan James's improved implementation. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124650/new/ https://reviews.llvm.org/D124650 ___ cfe-co

[PATCH] D125770: [clang-tidy] modernize-deprecated-headers should ignore system headers

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125770/new/ https://reviews.llvm.org/D125770 _

[PATCH] D124806: [clang-tidy] add support for Demorgan conversions to readability-simplify-bool-expr

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. In D124806#3523228 , @njames93 wrote: > In D124806#3523109 , > @LegalizeAdulthood wrote: > >> LGTM! Thanks for taking my idea and implementing it much better than what I >> ha

[PATCH] D121372: [clang-tidy][docs][NFC] Update URL and docs of PostfixOperatorCheck

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:116 `bugprone-virtual-near-miss `_, "Yes" - `cert-dcl21-cpp `_, + `cert-dcl21-cpp `_, "Yes" `cert-dcl50-cpp `_, The problem with making this change

[PATCH] D121372: [clang-tidy][docs][NFC] Update URL and docs of PostfixOperatorCheck

2022-05-18 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:116 `bugprone-virtual-near-miss `_, "Yes" - `cert-dcl21-cpp `_, + `cert-dcl21-cpp `_, "Yes" `cert-dcl50-cpp `_, LegalizeAdulthood wrote: > The probl

[PATCH] D125771: [clang-tidy] Add a useful note about -std=c++11-or-later

2022-05-19 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. In D125771#3525252 , @njames93 wrote: > Tbh the whole testing infrastructure for clang-tidy is a mess. When I have > wanted to verify fixes and diagnostics for header files, I find manually > invoking clang-tidy is bet

[PATCH] D125769: [clang-tidy] Introduce the CheckHeaderFile option to modernize-deprecated-headers

2022-05-19 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h:63 std::vector IncludesToBeProcessed; + bool WarnIntoHeaders; }; whisperity wrote: > LegalizeAdulthood wrote: > > 1) How is this different fr

[PATCH] D125771: [clang-tidy] Add a useful note about -std=c++11-or-later

2022-05-20 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/test/clang-tidy/check_clang_tidy.py:22 [-check-suffixes=] \ +[-std=(c++11-or-later|c++17)] \ \ These aren't the only two valid options for this argument Valid values are:

[PATCH] D125769: [clang-tidy] Introduce the CheckHeaderFile option to modernize-deprecated-headers

2022-05-20 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/docs/ReleaseNotes.rst:180 + the ``CheckHeaderFile=true`` option if header files of the project only + included by c++ source files. Capitalize to `C++` Comment at: clan

[PATCH] D125769: [clang-tidy] Introduce the CheckHeaderFile option to modernize-deprecated-headers

2022-05-20 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. LGTM Address one nit and ship. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125769/new/ https://reviews.llvm.org/D125769

[PATCH] D125209: [clang-tidy] modernize-deprecated-headers check should respect extern "C" blocks

2022-05-20 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D125209/new/ https://reviews.llvm.org/D125209 _

[PATCH] D117409: [clang-tidy] Move IncludeInserter into ClangTidyContext

2022-05-20 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. Herald added a project: All. If the only thing holding this up is my comments about following the Law of Demeter, I don't think that should block submitting this change.

[PATCH] D117460: [clang-tidy][NFC] Reduce map lookups in IncludeSorter

2022-05-20 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added a comment. Herald added a project: All. Are we waiting on some sort of benchmark before accepting/rejecting this change? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117460/new/ https://reviews.llvm.org/D117460 ___

[PATCH] D125771: [clang-tidy] Add a useful note about -std=c++11-or-later

2022-05-20 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/test/clang-tidy/check_clang_tidy.py:31 + -std=c++(98|11|14|17|20)[-or-later]: +This flag will cause multiple runs within the same check_clang_tidy +execution. Make sure you don't have shared state acr

[PATCH] D126134: [clang-tidy] Improve add_new_check.py to recognize more checks

2022-05-21 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood created this revision. LegalizeAdulthood added reviewers: aaron.ballman, njames93, alexfh. LegalizeAdulthood added a project: clang-tools-extra. Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a project: All. LegalizeAdulthood requested review of this revision. W

[PATCH] D126134: [clang-tidy] Improve add_new_check.py to recognize more checks

2022-05-23 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 2 inline comments as done. LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/add_new_check.py:335-336 +module_file = get_module_filename(module_path, module_name) +if not os.path.isfile(module_file): + return '

[PATCH] D126162: [clang-tidy] Extend SimplifyBooleanExpr demorgan support.

2022-05-23 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood accepted this revision. LegalizeAdulthood added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126162/new/ https://reviews.llvm.org/D126162 _

[PATCH] D126134: [clang-tidy] Improve add_new_check.py to recognize more checks

2022-05-23 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood marked 2 inline comments as done. LegalizeAdulthood added a comment. Another observation: If some new pattern comes up and fixits aren't recognized for a check, it might be better to switch to a whitelist for checks with fixits rather than going crazier on the file scraping.

[PATCH] D126134: [clang-tidy] Improve add_new_check.py to recognize more checks

2022-05-23 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/add_new_check.py:352 + stmt = code[stmt_start_pos+1:stmt_end_pos] + matches = re.search('registerCheck<([^>:]*)>\(\s*"([^"]*)"\s*\)', stmt) + if matches and matches[2] == full_check_n

[PATCH] D126134: [clang-tidy] Improve add_new_check.py to recognize more checks

2022-05-23 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood updated this revision to Diff 431383. LegalizeAdulthood added a comment. Update from review comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126134/new/ https://reviews.llvm.org/D126134 Files: clang-tools-extra/clang-tidy/add_new_check.py clang-tools-extra/d

[PATCH] D126134: [clang-tidy] Improve add_new_check.py to recognize more checks

2022-05-23 Thread Richard via Phabricator via cfe-commits
LegalizeAdulthood added inline comments. Comment at: clang-tools-extra/clang-tidy/add_new_check.py:335-336 +module_file = get_module_filename(module_path, module_name) +if not os.path.isfile(module_file): + return '' +with io.open(module_file, 'r') as f:

<    1   2   3   4   5   >