summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-bitfields.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-bitfields.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-bitfields.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-bitfields.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-bitfields.cpp
new file mode 100644
index 00000000000..3c1fef939c6
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability-magic-numbers-bitfields.cpp
@@ -0,0 +1,22 @@
+// RUN: %check_clang_tidy %s readability-magic-numbers %t \
+// RUN: -config='{CheckOptions: \
+// RUN: [{key: readability-magic-numbers.IgnoredIntegerValues, value: "1;2;10;100;"}]}' \
+// RUN: --
+
+struct HardwareGateway {
+ /*
+ * The configuration suppresses the warnings for the bitfields...
+ */
+ unsigned int Some: 5;
+ unsigned int Bits: 7;
+ unsigned int: 7;
+ unsigned int: 0;
+ unsigned int Rest: 13;
+
+ /*
+ * ... but other fields trigger the warning.
+ */
+ unsigned int Another[3];
+ // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
+};
+
OpenPOWER on IntegriCloud