Hi alexfh,
Minor cleanups in readability-container-size-empty checker:
- Removed an unused header
- Simplified the custom ast_matchers
http://reviews.llvm.org/D7088
Files:
clang-tidy/readability/ContainerSizeEmpty.cpp
Index: clang-tidy/readability/ContainerSizeEmpty.cpp
===================================================================
--- clang-tidy/readability/ContainerSizeEmpty.cpp
+++ clang-tidy/readability/ContainerSizeEmpty.cpp
@@ -13,7 +13,6 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/ASTMatchers/ASTMatchersInternal.h"
#include "clang/Lex/Lexer.h"
using namespace clang::ast_matchers;
@@ -46,13 +45,8 @@
namespace clang {
namespace ast_matchers {
-AST_MATCHER_P(QualType, unqualifiedType, internal::Matcher<Type>,
- InnerMatcher) {
- return InnerMatcher.matches(*Node, Finder, Builder);
-}
+AST_MATCHER(QualType, isBoolType) { return Node->isBooleanType(); }
-AST_MATCHER(Type, isBoolType) { return Node.isBooleanType(); }
-
AST_MATCHER(NamedDecl, stlContainer) {
return isContainer(Node.getQualifiedNameAsString());
}
@@ -78,12 +72,11 @@
hasLHS(integerLiteral(equals(1)))))))
.bind("SizeBinaryOp")),
hasParent(implicitCastExpr(
- hasImplicitDestinationType(unqualifiedType(isBoolType())),
+ hasImplicitDestinationType(isBoolType()),
anyOf(
hasParent(unaryOperator(hasOperatorName("!")).bind("NegOnSize")),
anything()))),
- hasParent(
-
explicitCastExpr(hasDestinationType(unqualifiedType(isBoolType())))));
+ hasParent(explicitCastExpr(hasDestinationType(isBoolType()))));
Finder->addMatcher(
memberCallExpr(
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: clang-tidy/readability/ContainerSizeEmpty.cpp
===================================================================
--- clang-tidy/readability/ContainerSizeEmpty.cpp
+++ clang-tidy/readability/ContainerSizeEmpty.cpp
@@ -13,7 +13,6 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/ASTMatchers/ASTMatchersInternal.h"
#include "clang/Lex/Lexer.h"
using namespace clang::ast_matchers;
@@ -46,13 +45,8 @@
namespace clang {
namespace ast_matchers {
-AST_MATCHER_P(QualType, unqualifiedType, internal::Matcher<Type>,
- InnerMatcher) {
- return InnerMatcher.matches(*Node, Finder, Builder);
-}
+AST_MATCHER(QualType, isBoolType) { return Node->isBooleanType(); }
-AST_MATCHER(Type, isBoolType) { return Node.isBooleanType(); }
-
AST_MATCHER(NamedDecl, stlContainer) {
return isContainer(Node.getQualifiedNameAsString());
}
@@ -78,12 +72,11 @@
hasLHS(integerLiteral(equals(1)))))))
.bind("SizeBinaryOp")),
hasParent(implicitCastExpr(
- hasImplicitDestinationType(unqualifiedType(isBoolType())),
+ hasImplicitDestinationType(isBoolType()),
anyOf(
hasParent(unaryOperator(hasOperatorName("!")).bind("NegOnSize")),
anything()))),
- hasParent(
- explicitCastExpr(hasDestinationType(unqualifiedType(isBoolType())))));
+ hasParent(explicitCastExpr(hasDestinationType(isBoolType()))));
Finder->addMatcher(
memberCallExpr(
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits