Index: clang-tidy/llvm/TwineLocalCheck.cpp =================================================================== --- clang-tidy/llvm/TwineLocalCheck.cpp +++ clang-tidy/llvm/TwineLocalCheck.cpp @@ -34,6 +34,10 @@ // Peel away implicit constructors and casts so we can see the actual type // of the initializer. const Expr *C = VD->getInit(); + + if (auto Expr = dyn_cast(C)) + C = Expr->getSubExpr(); + while (isa(C)) C = cast(C)->getArg(0)->IgnoreParenImpCasts(); Index: clang-tidy/misc/DanglingHandleCheck.cpp =================================================================== --- clang-tidy/misc/DanglingHandleCheck.cpp +++ clang-tidy/misc/DanglingHandleCheck.cpp @@ -135,7 +135,7 @@ // 1. Value to Handle conversion. // 2. Handle copy construction. // We have to match both. - has(ignoringParenImpCasts(handleFrom( + has(ignoringExprWithCleanups(ignoringParenImpCasts(handleFrom( IsAHandle, handleFrom(IsAHandle, declRefExpr(to(varDecl( // Is function scope ... @@ -143,7 +143,7 @@ // ... and it is a local array or Value. anyOf(hasType(arrayType()), hasType(recordDecl( - unless(IsAHandle))))))))))), + unless(IsAHandle)))))))))))), // Temporary fix for false positives inside lambdas. unless(hasAncestor(lambdaExpr()))) .bind("bad_stmt"), Index: clang-tidy/modernize/LoopConvertCheck.cpp =================================================================== --- clang-tidy/modernize/LoopConvertCheck.cpp +++ clang-tidy/modernize/LoopConvertCheck.cpp @@ -141,10 +141,10 @@ StatementMatcher IteratorComparisonMatcher = expr( ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName))))); - StatementMatcher OverloadedNEQMatcher = + StatementMatcher OverloadedNEQMatcher = ignoringExprWithCleanups( 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-tidy/modernize/LoopConvertUtils.cpp =================================================================== --- clang-tidy/modernize/LoopConvertUtils.cpp +++ clang-tidy/modernize/LoopConvertUtils.cpp @@ -156,6 +156,8 @@ const Expr *digThroughConstructors(const Expr *E) { if (!E) return nullptr; + if (auto Cleanups = dyn_cast(E)) + E = Cleanups->getSubExpr(); E = E->IgnoreParenImpCasts(); if (const auto *ConstructExpr = dyn_cast(E)) { // The initial constructor must take exactly one parameter, but base class Index: clang-tidy/modernize/UseAutoCheck.cpp =================================================================== --- clang-tidy/modernize/UseAutoCheck.cpp +++ clang-tidy/modernize/UseAutoCheck.cpp @@ -42,6 +42,9 @@ if (!Init) return false; + if (const auto *E = dyn_cast(Init)) + Init = E->getSubExpr(); + // The following test is based on DeclPrinter::VisitVarDecl() to find if an // initializer is implicit or not. if (const auto *Construct = dyn_cast(Init)) { Index: clang-tidy/readability/RedundantStringInitCheck.cpp =================================================================== --- clang-tidy/readability/RedundantStringInitCheck.cpp +++ clang-tidy/readability/RedundantStringInitCheck.cpp @@ -48,12 +48,13 @@ // 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(ignoringExprWithCleanups(anyOf( + EmptyStringCtorExpr, + EmptyStringCtorExprWithTemporaries))) + .bind("expr"))), + unless(parmVarDecl())) .bind("decl"), this); }