[clang-tidy] google-explicit-constructor: ignore compiler-generated conversion operators.

llvm-svn: 290668
This commit is contained in:
Alexander Kornienko 2016-12-28 13:48:03 +00:00
parent b111409015
commit dd0c0ba82c
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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 {