[clang-tools-extra] r298057 - [clang-tidy] Verify some conditions in a matcher instead of check(). NFC
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 17 02:47:06 PDT 2017
Author: alexfh
Date: Fri Mar 17 04:47:05 2017
New Revision: 298057
URL: http://llvm.org/viewvc/llvm-project?rev=298057&view=rev
Log:
[clang-tidy] Verify some conditions in a matcher instead of check(). NFC
Modified:
clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp?rev=298057&r1=298056&r2=298057&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/google/ExplicitConstructorCheck.cpp Fri Mar 17 04:47:05 2017
@@ -24,8 +24,11 @@ void ExplicitConstructorCheck::registerM
// 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(con
}
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(
More information about the cfe-commits
mailing list