File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1414
1515namespace clang ::tidy::readability {
1616
17- // / Replaces certain integer literals with equivalent calls to
18- // / ``std::numeric_limits``.
17+ // / Finds certain integer literals and suggests replacing them with equivalent
18+ // / ``std::numeric_limits`` calls .
1919// / For the user-facing documentation see:
2020// / http://clang.llvm.org/extra/clang-tidy/checks/readability/use-numeric-limits.html
2121class UseNumericLimitsCheck : public ClangTidyCheck {
Original file line number Diff line number Diff line change 33readability-use-numeric-limits
44==============================
55
6- Replaces certain integer literals with equivalent calls to
7- ``std::numeric_limits<T>::min() `` or `` std::numeric_limits<T>::max() `` .
6+ Finds certain integer literals and suggests replacing them with equivalent
7+ ``std::numeric_limits `` calls .
88
99Before:
1010
Original file line number Diff line number Diff line change 11// RUN: %check_clang_tidy %s readability-use-numeric-limits %t
2- #include < stdint.h>
2+ // CHECK-FIXES: #include <limits>
3+
4+ using int8_t = signed char ;
5+ using int16_t = short ;
6+ using int32_t = int ;
7+ using int64_t = long long ;
8+ using uint8_t = unsigned char ;
9+ using uint16_t = unsigned short ;
10+ using uint32_t = unsigned int ;
11+ using uint64_t = unsigned long long ;
12+
313
414void Invalid () {
515 // CHECK-MESSAGES: :[[@LINE+2]]:14: warning: the constant '-128' is being utilized; consider using 'std::numeric_limits<int8_t>::min()' instead [readability-use-numeric-limits]
You can’t perform that action at this time.
0 commit comments