[PATCH] D146913: [clang-tidy] Add option to ignore user-defined literals in readability-magic-numbers

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 26 06:11:17 PDT 2023


carlosgalvezp created this revision.
Herald added subscribers: PiotrZSL, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
carlosgalvezp requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Some user-defined literals operate on implementation-defined types, like
"unsigned long long" and "long double", which are not well supported by
this check. Currently, the check gives warnings when using UDLs, without
giving possiblity to the user to whitelist common UDLs. A good compromise
until a proper fix is found (if any) is to allow the user to disable
warnings on UDLs.

Partially fixes #61656


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146913

Files:
  clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
  clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/readability/magic-numbers.rst
  clang-tools-extra/test/clang-tidy/checkers/readability/magic-numbers-userliteral.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146913.508407.patch
Type: text/x-patch
Size: 6531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230326/d7301b63/attachment.bin>


More information about the cfe-commits mailing list