aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-tidy/checkers/readability
diff options
context:
space:
mode:
authorPiotr Zegar <me@piotrzegar.pl>2024-06-05 20:17:32 +0200
committerGitHub <noreply@github.com>2024-06-05 20:17:32 +0200
commit461dcd4a000fa2b88759a275bc6803b89efc5972 (patch)
tree97e5f13652366bfeefeb172268cda3f666b79d4a /clang-tools-extra/test/clang-tidy/checkers/readability
parent31ba25ec604cff73331526fc9555e07fdd3152fe (diff)
downloadllvm-461dcd4a000fa2b88759a275bc6803b89efc5972.zip
llvm-461dcd4a000fa2b88759a275bc6803b89efc5972.tar.gz
llvm-461dcd4a000fa2b88759a275bc6803b89efc5972.tar.bz2
[clang-tidy] Fix handling of members in readability-redundant-member-init (#93217)
Compare class type instead of just assuming that called constructor belong to same class. Fixes #91605
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/checkers/readability')
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/readability/redundant-member-init.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-member-init.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-member-init.cpp
index 17b2714..6f18a60 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-member-init.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-member-init.cpp
@@ -302,3 +302,19 @@ struct D7 {
D7<int> d7i;
D7<S> d7s;
+
+struct SS {
+ SS() = default;
+ SS(S s) : s(s) {}
+
+ S s;
+};
+
+struct D8 {
+ SS ss = S();
+};
+
+struct D9 {
+ D9() : ss(S()) {}
+ SS ss;
+};