summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-04-21 16:57:56 +0000
committerEtienne Bergeron <etienneb@google.com>2016-04-21 16:57:56 +0000
commit9d26599078d956e5c4fbb9db51b54c4752106133 (patch)
tree4341baccc6c72e1bd8aef14cc498232b5395468e /clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp
parent0c869a752ecb3aa06b4c01d36962bac7a301264e (diff)
downloadbcm5719-llvm-9d26599078d956e5c4fbb9db51b54c4752106133.tar.gz
bcm5719-llvm-9d26599078d956e5c4fbb9db51b54c4752106133.zip
[clang-tidy] Cleanup some ast-matchers and lift some to utils.
Summary: Little cleanup to lift-out and to remove some frequently used ast-matchers. Some of theses matchers are candidates to be lifted to ASTMatchers.h. Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19200 llvm-svn: 267003
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp b/clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp
index c0a223d17a7..e310e322a6f 100644
--- a/clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/SizeofExpressionCheck.cpp
@@ -10,6 +10,7 @@
#include "SizeofExpressionCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "../utils/Matchers.h"
using namespace clang::ast_matchers;
@@ -19,10 +20,6 @@ namespace misc {
namespace {
-AST_MATCHER(BinaryOperator, isRelationalOperator) {
- return Node.isRelationalOp();
-}
-
AST_MATCHER_P(IntegerLiteral, isBiggerThan, unsigned, N) {
return Node.getValue().getZExtValue() > N;
}
@@ -139,7 +136,7 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
// Detect expression like: sizeof(epxr) <= k for a suspicious constant 'k'.
if (WarnOnSizeOfCompareToConstant) {
Finder->addMatcher(
- binaryOperator(isRelationalOperator(),
+ binaryOperator(matchers::isRelationalOperator(),
hasEitherOperand(ignoringParenImpCasts(SizeOfExpr)),
hasEitherOperand(ignoringParenImpCasts(
anyOf(integerLiteral(equals(0)),
OpenPOWER on IntegriCloud