summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clang-tidy/llvm/TwineLocalCheck.cpp3
-rw-r--r--clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp5
-rw-r--r--clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp18
6 files changed, 20 insertions, 14 deletions
diff --git a/clang-tools-extra/clang-tidy/llvm/TwineLocalCheck.cpp b/clang-tools-extra/clang-tidy/llvm/TwineLocalCheck.cpp
index 0d9c5ecd248..2f39f46e63f 100644
--- a/clang-tools-extra/clang-tidy/llvm/TwineLocalCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvm/TwineLocalCheck.cpp
@@ -33,7 +33,8 @@ void TwineLocalCheck::check(const MatchFinder::MatchResult &Result) {
if (VD->hasInit()) {
// Peel away implicit constructors and casts so we can see the actual type
// of the initializer.
- const Expr *C = VD->getInit();
+ const Expr *C = VD->getInit()->IgnoreImplicit();
+
while (isa<CXXConstructExpr>(C))
C = cast<CXXConstructExpr>(C)->getArg(0)->IgnoreParenImpCasts();
diff --git a/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp b/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp
index 97d23e0e0cf..67f83d27b42 100644
--- a/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/DanglingHandleCheck.cpp
@@ -8,11 +8,13 @@
//===----------------------------------------------------------------------===//
#include "DanglingHandleCheck.h"
+#include "../utils/Matchers.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
using namespace clang::ast_matchers;
+using namespace clang::tidy::matchers;
namespace clang {
namespace tidy {
@@ -135,7 +137,7 @@ void DanglingHandleCheck::registerMatchersForReturn(MatchFinder *Finder) {
// 1. Value to Handle conversion.
// 2. Handle copy construction.
// We have to match both.
- has(ignoringParenImpCasts(handleFrom(
+ has(ignoringImplicit(handleFrom(
IsAHandle,
handleFrom(IsAHandle, declRefExpr(to(varDecl(
// Is function scope ...
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
index bd476dd5e79..ad922382fcd 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "LoopConvertCheck.h"
+#include "../utils/Matchers.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
@@ -141,10 +142,10 @@ StatementMatcher makeIteratorLoopMatcher() {
StatementMatcher IteratorComparisonMatcher = expr(
ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName)))));
- StatementMatcher OverloadedNEQMatcher =
+ auto OverloadedNEQMatcher = matchers::ignoringImplicit(
cxxOperatorCallExpr(hasOverloadedOperatorName("!="), argumentCountIs(2),
hasArgument(0, IteratorComparisonMatcher),
- hasArgument(1, IteratorBoundMatcher));
+ hasArgument(1, IteratorBoundMatcher)));
// This matcher tests that a declaration is a CXXRecordDecl that has an
// overloaded operator*(). If the operator*() returns by value instead of by
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
index 75133df9078..3fee2c44c7e 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
@@ -156,7 +156,7 @@ bool DeclFinderASTVisitor::VisitTypeLoc(TypeLoc TL) {
const Expr *digThroughConstructors(const Expr *E) {
if (!E)
return nullptr;
- E = E->IgnoreParenImpCasts();
+ E = E->IgnoreImplicit();
if (const auto *ConstructExpr = dyn_cast<CXXConstructExpr>(E)) {
// The initial constructor must take exactly one parameter, but base class
// and deferred constructors can take more.
diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
index 1f1c140f027..8c43e6b754f 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
@@ -42,6 +42,8 @@ AST_MATCHER(VarDecl, hasWrittenNonListInitializer) {
if (!Init)
return false;
+ Init = Init->IgnoreImplicit();
+
// The following test is based on DeclPrinter::VisitVarDecl() to find if an
// initializer is implicit or not.
if (const auto *Construct = dyn_cast<CXXConstructExpr>(Init)) {
diff --git a/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp b/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
index 17ae4ef3d3a..7ca8323b7dc 100644
--- a/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp
@@ -39,21 +39,21 @@ void RedundantStringInitCheck::registerMatchers(MatchFinder *Finder) {
stringLiteral(hasSize(0)))));
const auto EmptyStringCtorExprWithTemporaries =
- expr(ignoringImplicit(
- cxxConstructExpr(StringConstructorExpr,
- hasArgument(0, ignoringImplicit(EmptyStringCtorExpr)))));
+ cxxConstructExpr(StringConstructorExpr,
+ hasArgument(0, ignoringImplicit(EmptyStringCtorExpr)));
// Match a variable declaration with an empty string literal as initializer.
// Examples:
// string foo = "";
// string bar("");
Finder->addMatcher(
- namedDecl(varDecl(hasType(cxxRecordDecl(hasName("basic_string"))),
- hasInitializer(
- expr(anyOf(EmptyStringCtorExpr,
- EmptyStringCtorExprWithTemporaries))
- .bind("expr"))),
- unless(parmVarDecl()))
+ namedDecl(
+ varDecl(hasType(cxxRecordDecl(hasName("basic_string"))),
+ hasInitializer(expr(ignoringImplicit(anyOf(
+ EmptyStringCtorExpr,
+ EmptyStringCtorExprWithTemporaries)))
+ .bind("expr"))),
+ unless(parmVarDecl()))
.bind("decl"),
this);
}
OpenPOWER on IntegriCloud