This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by carlosgalvezp on Mar 26 2023, 6:11 AM.

Details

Summary

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

Diff Detail

Event Timeline

carlosgalvezp created this revision.Mar 26 2023, 6:11 AM
Herald added a project: Restricted Project. · View Herald Transcript
carlosgalvezp requested review of this revision.Mar 26 2023, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 26 2023, 6:11 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
PiotrZSL accepted this revision.Mar 26 2023, 6:15 AM

LGTM

clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.h
52–59

Move this to CPP.

This revision is now accepted and ready to land.Mar 26 2023, 6:15 AM

Move implementation to .cpp file.

carlosgalvezp marked an inline comment as done.Mar 26 2023, 6:35 AM
Eugene.Zelenko accepted this revision.Mar 26 2023, 6:37 AM
PiotrZSL accepted this revision.Mar 26 2023, 6:49 AM