From 7baa783763c946ff667c3faea292e91d3de1e459 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 8 Oct 2023 08:52:27 +0000 Subject: [PATCH] Bug 1857550 - clang-tidy: add test for readability-redundant-member-init r=linter-reviewers,andi Differential Revision: https://phabricator.services.mozilla.com/D190396 --- .../test/readability-redundant-member-init.cpp | 11 +++++++++++ .../test/readability-redundant-member-init.json | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 tools/clang-tidy/test/readability-redundant-member-init.cpp create mode 100644 tools/clang-tidy/test/readability-redundant-member-init.json diff --git a/tools/clang-tidy/test/readability-redundant-member-init.cpp b/tools/clang-tidy/test/readability-redundant-member-init.cpp new file mode 100644 index 000000000000..d8ebe08ec476 --- /dev/null +++ b/tools/clang-tidy/test/readability-redundant-member-init.cpp @@ -0,0 +1,11 @@ + +struct S { + S() = default; + S(int i) : i(i) {} + int i = 1; +}; + +struct F1 { + F1() : f() {} + S f; +}; diff --git a/tools/clang-tidy/test/readability-redundant-member-init.json b/tools/clang-tidy/test/readability-redundant-member-init.json new file mode 100644 index 000000000000..65b24ba2dd15 --- /dev/null +++ b/tools/clang-tidy/test/readability-redundant-member-init.json @@ -0,0 +1,8 @@ +[ + [ + "warning", + "initializer for member 'f' is redundant", + "readability-redundant-member-init" + ], + { "reliability": "high" } +]