28 lines · cpp
1// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- \2// RUN: -config="{CheckOptions: {readability-uppercase-literal-suffix.IgnoreMacros: false}}" \3// RUN: -- -I %S4 5void macros() {6#define INMACRO(X) 1.f7 static constexpr auto m1 = INMACRO();8 // CHECK-NOTES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase9 // CHECK-NOTES: :[[@LINE-3]]:20: note: expanded from macro 'INMACRO'10 // CHECK-FIXES: #define INMACRO(X) 1.f11 // CHECK-FIXES: static constexpr auto m1 = INMACRO();12 // ^ so no fix-its here.13}14 15void horrible_macros() {16#define MAKE_UNSIGNED(x) x##u17#define ONE MAKE_UNSIGNED(1)18 static constexpr auto hm0 = ONE;19 // CHECK-NOTES: :[[@LINE-1]]:31: warning: integer literal has suffix 'u', which is not uppercase20 // CHECK-NOTES: :[[@LINE-3]]:13: note: expanded from macro 'ONE'21 // CHECK-NOTES: :[[@LINE-5]]:26: note: expanded from macro 'MAKE_UNSIGNED'22 // CHECK-NOTES: note: expanded from here23 // CHECK-FIXES: #define MAKE_UNSIGNED(x) x##u24 // CHECK-FIXES: #define ONE MAKE_UNSIGNED(1)25 // CHECK-FIXES: static constexpr auto hm0 = ONE;26 // Certainly no fix-its.27}28