diff options
author | Jonathan Coe <jbcoe@me.com> | 2016-08-02 21:18:37 +0000 |
---|---|---|
committer | Jonathan Coe <jbcoe@me.com> | 2016-08-02 21:18:37 +0000 |
commit | 77ec263e6025155850f117c934ae11eceaba5f3a (patch) | |
tree | dfeb80312feeb81c156fbfcb9a37e38cd99b0ac0 /clang-tools-extra/test/clang-tidy/cppcoreguidelines-special-member-functions.cpp | |
parent | 6eb1ca74165a4e17d4f0193e879e729170257e39 (diff) | |
download | bcm5719-llvm-77ec263e6025155850f117c934ae11eceaba5f3a.tar.gz bcm5719-llvm-77ec263e6025155850f117c934ae11eceaba5f3a.zip |
[clang-tidy] Fix segfault in cppcore-guidelines-special-member-functions check
Summary:
Use a set rather than a vector of defined special member functions so
that multiple declarations of the same function are only counted once.
Move some private static member functions into the cpp file.
Run clang-format on header.
Reviewers: ericLemanissier, Prazek, aaron.ballman
Subscribers: Prazek, cfe-commits, nemanjai
Projects: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D23008
llvm-svn: 277523
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/cppcoreguidelines-special-member-functions.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/cppcoreguidelines-special-member-functions.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-special-member-functions.cpp b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-special-member-functions.cpp index 0eee919bf13..5461745ac66 100644 --- a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-special-member-functions.cpp +++ b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-special-member-functions.cpp @@ -50,3 +50,18 @@ class DeletesCopyDefaultsMove { DeletesCopyDefaultsMove &operator=(DeletesCopyDefaultsMove &&) = default; ~DeletesCopyDefaultsMove() = default; }; + +template <typename T> +struct TemplateClass { + TemplateClass() = default; + TemplateClass(const TemplateClass &); + TemplateClass &operator=(const TemplateClass &); + TemplateClass(TemplateClass &&); + TemplateClass &operator=(TemplateClass &&); + ~TemplateClass(); +}; + +// Multiple instantiations of a class template will trigger multiple matches for defined special members. +// This should not cause problems. +TemplateClass<int> InstantiationWithInt; +TemplateClass<double> InstantiationWithDouble; |