This revision was automatically updated to reflect the committed changes.
Closed by commit rL273310: Fix clang-tidy patterns to adapt to newly added
ExprWithCleanups nodes. (authored by timshen).
Changed prior to commit:
http://reviews.llvm.org/D21243?vs=60992&id=61434#toc
Repository:
rL LLVM
http://reviews.llvm.org/D21243
Files:
clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp
Index: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
@@ -156,7 +156,7 @@
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.
Index: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
+++ clang-tools-extra/trunk/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 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
Index: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
@@ -42,6 +42,8 @@
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)) {
Index: clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/DanglingHandleCheck.cpp
+++ clang-tools-extra/trunk/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 @@
// 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 ...
Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantStringInitCheck.cpp
@@ -39,21 +39,21 @@
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);
}
Index: clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/llvm/TwineLocalCheck.cpp
@@ -33,7 +33,8 @@
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();
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits