forked from OSchip/llvm-project
[clang-tidy] Verify some conditions in a matcher instead of check(). NFC
llvm-svn: 298057
This commit is contained in:
parent
913ffeb5ba
commit
c7c9b75804
|
@ -24,8 +24,11 @@ void ExplicitConstructorCheck::registerMatchers(MatchFinder *Finder) {
|
|||
// provide any benefit to other languages, despite being benign.
|
||||
if (!getLangOpts().CPlusPlus)
|
||||
return;
|
||||
Finder->addMatcher(cxxConstructorDecl(unless(isInstantiated())).bind("ctor"),
|
||||
this);
|
||||
Finder->addMatcher(
|
||||
cxxConstructorDecl(unless(anyOf(isImplicit(), // Compiler-generated.
|
||||
isDeleted(), isInstantiated())))
|
||||
.bind("ctor"),
|
||||
this);
|
||||
Finder->addMatcher(
|
||||
cxxConversionDecl(unless(anyOf(isExplicit(), // Already marked explicit.
|
||||
isImplicit(), // Compiler-generated.
|
||||
|
@ -99,10 +102,8 @@ void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
}
|
||||
|
||||
const auto *Ctor = Result.Nodes.getNodeAs<CXXConstructorDecl>("ctor");
|
||||
// Do not be confused: isExplicit means 'explicit' keyword is present,
|
||||
// isImplicit means that it's a compiler-generated constructor.
|
||||
if (Ctor->isOutOfLine() || Ctor->isImplicit() || Ctor->isDeleted() ||
|
||||
Ctor->getNumParams() == 0 || Ctor->getMinRequiredArguments() > 1)
|
||||
if (Ctor->isOutOfLine() || Ctor->getNumParams() == 0 ||
|
||||
Ctor->getMinRequiredArguments() > 1)
|
||||
return;
|
||||
|
||||
bool takesInitializerList = isStdInitializerList(
|
||||
|
|
Loading…
Reference in New Issue