[PATCH] D146913: [clang-tidy] Add option to ignore user-defined literals in readability-magic-numbers
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 26 06:15:57 PDT 2023
PiotrZSL accepted this revision.
PiotrZSL added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.h:52-59
+ bool isUserDefinedLiteral(
+ const clang::ast_matchers::MatchFinder::MatchResult &Result,
+ const clang::Expr *Literal) const {
+ auto Parents = Result.Context->getParents(*Literal);
+ if (Parents.empty())
+ return false;
+ return Parents[0].get<UserDefinedLiteral>() != nullptr;
----------------
Move this to CPP.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146913/new/
https://reviews.llvm.org/D146913
More information about the cfe-commits
mailing list