diff options
author | Alexander Kornienko <alexfh@google.com> | 2014-04-29 15:07:08 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2014-04-29 15:07:08 +0000 |
commit | 014225e11e24c140a991675b0f20b6bf8992cdd5 (patch) | |
tree | 117b74efdbdad6f131628e517606651960787dc2 /clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp | |
parent | 4418dda5ef7bc0e9baebc914ec0b6329ee58bbe0 (diff) | |
download | bcm5719-llvm-014225e11e24c140a991675b0f20b6bf8992cdd5.tar.gz bcm5719-llvm-014225e11e24c140a991675b0f20b6bf8992cdd5.zip |
Warn on explicit copy constructors.
Summary:
The Google C++ Style Guide doesn't require copy constructors to be
declared explicit, but some people do this by mistake. Make this check detect
and fix such cases.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3541
llvm-svn: 207531
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp')
-rw-r--r-- | clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp b/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp index b09afe2f9f7..3c024b1ed7e 100644 --- a/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp +++ b/clang-tools-extra/unittests/clang-tidy/GoogleModuleTest.cpp @@ -37,6 +37,16 @@ TEST(ExplicitConstructorCheckTest, OutOfLineDefinitions) { "class C { C(int i); }; C::C(int i) {}")); } +TEST(ExplicitConstructorCheckTest, RemoveExplicit) { + EXPECT_EQ("class A { A(const A&); };\n" + "class B { /*asdf*/ B(const B&); };\n" + "class C { /*asdf*/ C(const C&); };", + runCheckOnCode<ExplicitConstructorCheck>( + "class A { explicit A(const A&); };\n" + "class B { explicit /*asdf*/ B(const B&); };\n" + "class C { explicit/*asdf*/ C(const C&); };")); +} + } // namespace test } // namespace tidy } // namespace clang |