diff options
| author | Alexander Kornienko <alexfh@google.com> | 2016-12-28 13:48:03 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2016-12-28 13:48:03 +0000 |
| commit | 046e611b264a4e6471f070b1e0ed1360ef02c7d5 (patch) | |
| tree | ceb2b0d57c62d16ff1963eafcc8ca52acca9a69a | |
| parent | 6057e88c1f54065cdcab22431a148cb731ee5919 (diff) | |
[clang-tidy] google-explicit-constructor: ignore compiler-generated conversion operators.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@290668 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | clang-tidy/google/ExplicitConstructorCheck.cpp | 7 | ||||
| -rw-r--r-- | test/clang-tidy/google-explicit-constructor.cpp | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tidy/google/ExplicitConstructorCheck.cpp index ca81de1d..1257d100 100644 --- a/clang-tidy/google/ExplicitConstructorCheck.cpp +++ b/clang-tidy/google/ExplicitConstructorCheck.cpp @@ -26,8 +26,11 @@ void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) { return; Finder->addMatcher(cxxConstructorDecl(unless(isInstantiated())).bind("ctor"), this); - Finder->addMatcher(cxxConversionDecl(unless(isExplicit())).bind("conversion"), - this); + Finder->addMatcher( + cxxConversionDecl(unless(isExplicit()), // Already marked explicit. + unless(isImplicit())) // Compiler-generated. + .bind("conversion"), + this); } // Looks for the token matching the predicate and returns the range of the found diff --git a/test/clang-tidy/google-explicit-constructor.cpp b/test/clang-tidy/google-explicit-constructor.cpp index f8a154e5..6cc3435b 100644 --- a/test/clang-tidy/google-explicit-constructor.cpp +++ b/test/clang-tidy/google-explicit-constructor.cpp @@ -80,6 +80,10 @@ struct B { // CHECK-FIXES: {{^ }}B(::std::initializer_list<char> &&list6) {} }; +struct StructWithFnPointer { + void (*f)(); +} struct_with_fn_pointer = {[] {}}; + using namespace std; struct C { |
