Using an early return as it is more clear; NFC.

llvm-svn: 246444
This commit is contained in:
Aaron Ballman 2015-08-31 14:23:21 +00:00
parent f08bd00229
commit a96b33b1b1
1 changed files with 24 additions and 24 deletions

View File

@ -21,13 +21,14 @@ void AssignOperatorSignatureCheck::registerMatchers(
ast_matchers::MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (getLangOpts().CPlusPlus) {
const auto HasGoodReturnType = methodDecl(returns(lValueReferenceType(
pointee(unless(isConstQualified()),
hasDeclaration(equalsBoundNode("class"))))));
if (!getLangOpts().CPlusPlus)
return;
const auto IsSelf = qualType(anyOf(
hasDeclaration(equalsBoundNode("class")),
const auto HasGoodReturnType = methodDecl(returns(lValueReferenceType(pointee(
unless(isConstQualified()), hasDeclaration(equalsBoundNode("class"))))));
const auto IsSelf = qualType(
anyOf(hasDeclaration(equalsBoundNode("class")),
referenceType(pointee(hasDeclaration(equalsBoundNode("class"))))));
const auto IsSelfAssign =
methodDecl(unless(anyOf(isDeleted(), isPrivate(), isImplicit())),
@ -50,7 +51,6 @@ void AssignOperatorSignatureCheck::registerMatchers(
Finder->addMatcher(methodDecl(IsSelfAssign, isConst()).bind("Const"), this);
}
}
void AssignOperatorSignatureCheck::check(